Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C++ Language/Indirection/SmartPointers/OwnershipCycle

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

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)