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

Sign in to watch this lesson
Ownership Types, Views and Type Erasure · 3:45
A std::weak_ptr watches an object without owning it, using the control block's weak count. We use lock() to get a real owner or null, see that the control block outlives the object, build a cache and an observer list that never keep anything alive by themselves, watch two objects that own each other leak, and fix the cycle with a weak back edge.