Multiple ChoiceBeginner 45s
unique_ptr custom deleter size
How does a custom deleter affect the size of `std::unique_ptr<T, D>`?
Options
- 1It has no effect at all, because unique_ptr always stores exactly one pointer regardless of the deleter type.
- 2It always doubles the size of the unique_ptr, since the deleter is stored alongside the pointer in the object.
- 3A stateless deleter can be empty-base-optimized so sizeof stays one pointer; a stateful/deleter-function template adds size.
- 4It is stored in a heap-allocated control block, so it never contributes anything to the sizeof of the unique_ptr.
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.