Files
developer-roadmap/roadmaps/cpp/content/weak_ptr@vUwSS-uX36OWZouO0wOcy.md
Arik Chakma 274082fd77 feat: clean roadmap content and sync scripts (#10181)
* refactor: clean to roadmap content

* refactor: move shared helpers into scripts/lib
2026-07-28 05:45:17 +06:00

3 lines
533 B
Markdown

# weak_ptr
`weak_ptr` is a smart pointer in C++ that holds a non-owning reference to an object managed by a `shared_ptr`. It doesn't participate in the object's ownership count, meaning that it doesn't prevent the object from being destroyed if the `shared_ptr`s owning the object go out of scope. Its primary use is to detect if the object managed by the `shared_ptr` still exists. You can obtain a `shared_ptr` from a `weak_ptr` using `lock()`, but this might return an empty `shared_ptr` if the object has already been destroyed.