On this page
C++ <memory> (Smart Pointers)
Prev: stdlib | Up: stdlib | Next: containers
Rel: RAII & Destructors, RAII, Smart Pointers & Lifetime
Ref: cppreference — <memory>
Tags: #public #prog #cpp #stdlib #memory #index
Core (#tier/core)
- std::unique_ptr — Zero-overhead single-owner smart pointer (default choice for heap ownership).
- std::make_unique — Exception-safe factory function for creating
std::unique_ptr.
Standard (#tier/standard)
- std::shared_ptr — Atomic reference-counted shared ownership smart pointer.
Specialized (#tier/specialized)
- std::weak_ptr — Non-owning observer that breaks
std::shared_ptrreference cycles.
Legacy (#tier/legacy)
- std::auto_ptr (Removed) — Removed in C++17; prefer std::unique_ptr.
Linked from
Related notes
- tuts/cpp/stdlib Linked here; links to this page; shared tags: #cpp, #index, #prog, #stdlib
- tuts/cpp/stdlib/containers Linked here; links to this page; shared tags: #cpp, #index, #prog, #stdlib
- tuts/cpp/stdlib/memory/auto_ptr Linked here; links to this page; shared tags: #cpp, #memory, #prog, #stdlib
- tuts/cpp/stdlib/memory/make_unique Linked here; links to this page; shared tags: #cpp, #memory, #prog, #stdlib
- tuts/cpp/stdlib/memory/shared_ptr Linked here; links to this page; shared tags: #cpp, #memory, #prog, #stdlib
- tuts/cpp/stdlib/memory/unique_ptr Linked here; links to this page; shared tags: #cpp, #memory, #prog, #stdlib
- tuts/cpp/stdlib/memory/weak_ptr Linked here; links to this page; shared tags: #cpp, #memory, #prog, #stdlib
- tuts/cpp/language_and_raii/raii_smart_pointers_and_lifetime Linked here; links to this page; shared tags: #cpp, #memory, #prog
- tuts/cpp/builtins/raii_and_destructors Linked here; shared tags: #cpp, #prog
- tuts/cpp/stdlib/algorithm_and_ranges shared tags: #cpp, #index, #prog, #stdlib