LearnFrenzy
Sign in Take a free test

Smart Pointers · Smart Pointers MCQ · Question 19

What is a custom deleter for? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 19 Back to Exercise

Why give a unique_ptr a custom deleter such as fclose?

  • A To speed up delete
  • B So it can manage resources that are not released with delete, e.g. FILE*, sockets, C library handles Correct
  • C To allow copying
  • D To make it shared
Correct Answer: Option B

The deleter type is part of unique_ptr's type; for shared_ptr it is stored in the control block.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links