Multiple ChoiceBeginner 45s
make_shared single allocation
Compared to `std::shared_ptr<T>(new T(...))`, `std::make_shared<T>(...)` typically:
Options
- 1Performs a single allocation holding the control block and object together, improving locality and exception safety.
- 2It avoids the need for atomic reference counting, since the control block is stored inline.
- 3It allows custom deleters more flexibly than the constructor form does for the same object.
- 4It stores the object in thread-local storage, giving faster access from the owning thread.
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.