All Smart Pointers and Ownership Types

All Smart Pointers and Ownership Types

A compact index of ownership, observing, and lifetime-adjacent utility types in modern C++.

How to use this reference page

Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.

  • Scan the top of the page first to identify the primary types, functions, or algorithm families involved.
  • Use the nearby-page links when your question is really about a companion header, related algorithm family, or broader subsystem.
  • Validate tricky behavior with a small compileable example before relying on memory for details like invalidation, ordering, allocation, or lifetime rules.

All Smart Pointers and Ownership Types

This page focuses on ownership vocabulary rather than every allocator detail.

Exclusive ownership

Shared ownership

Construction helpers

Pointer casts for shared ownership

Observing and non-owning views

Ownership-adjacent utilities

Practical rules

Example in practice

#include <memory>

int main() {
    auto owner = std::make_unique<int>(42);
    auto shared = std::make_shared<int>(*owner);
    owner.reset();
    return *shared;
}