⚡ Build the skills to land top-paying quant jobs. Offer ends in 23d 14h 02m 46s23 days 14 hours 2 minutes 46 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 23d 14h 02m 46s23 days 14 hours 2 minutes 46 seconds.

Sign in to watch this lesson
Ownership Types, Views and Type Erasure · 3:48
Why the standard library would rather call new for you. make_unique and make_shared name the type once, make sure the object is owned before anything can throw (we force a bad_alloc to watch emplace_back(new W) leak), and make_shared fuses the object and its control block into one allocation, which we measure on a Mac. The cost: that fused block stays allocated until the last weak_ptr is gone, and the make functions can't take custom deleters or braces.