Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 25s8 days 9 hours 54 minutes 25 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 25s8 days 9 hours 54 minutes 25 seconds.

Sign in to watch this lesson
Ownership Types, Views and Type Erasure · 3:24
A std::shared_ptr is two pointers: one to the object and one to a control block that counts owners. We watch the count rise and fall to zero, read the assembly clang generates for a copy (one atomic add) versus a move (none), break it with two control blocks from one raw pointer, and fix member functions with enable_shared_from_this.