C++ Language/Indirection/SmartPointers/OwnershipCycle
The std::weak_ptr<>
type is for situations where you need access to the shared memory payload that is being collectively managed by several std::shared_ptr<>
, but you don't want this std::weak_ptr<>
to affect the reference count.
A cyclic data structure is one example where that is needed.
Additional information about weak_ptr (includes interactive examples)