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!