Skip to main content

8 docs tagged with "smart-pointers"

View all tags

boost::intrusive_ptr

boost::intrusive_ptr is a reference-counting smart pointer that keeps the count inside the

Custom Deleters

Extend smart pointers to manage any resource requiring special cleanup beyond delete. Enable RAII for files, handles, connections, locks - anything needing cleanup.

Smart Pointers Overview

Boost.SmartPtr is where modern C++ ownership semantics were invented. Long before std::shared_ptr

std::shared_ptr

Smart pointer with shared ownership via reference counting. Multiple shared_ptrs can own the same object, deleted when last owner destroyed.

std::unique_ptr

Smart pointer with exclusive ownership. Zero overhead, automatic cleanup, move-only semantics. The default choice for dynamic memory.

std::weak_ptr

Non-owning observer of shared_ptr-managed objects. Doesn't increase reference count, enables checking if object still exists.