// memory still exists! if (p2) { DoSomethingWith(p2); } } // p2 is destroyed. Memory is owned by p1. p1.reset(); // Free the memory. std::shared_ptr<int> p3 = wp1.lock(); // Memory is gone, so we get an empty shared_ptr. if (p3) { // code will not execute ActionThatNeedsALivePointer(p3); } Because the implementation of uses reference counting, circular references are potentially a problem. A circular shared_ptr chain can be broken by changing the code so that one of the references is a weak_ptr. Multiple threads can safely simultaneously access different and objects that point to the same object. The referenced object must be protected separately to ensure thread safety. and are based on versions used by the Boost libraries. C++ Technical Report 1 (TR1) first introduced them to the standard, as general utilities, but C++11 adds more functions, in line with the Boost version. Other types of smart pointers There are other types of smart pointers (which are not in the C++ standard) implemented on popular C++ libraries or custom STL, some examples include hazard pointer and intrusive pointer. See also auto_ptr Fat pointer Tagged pointer Opaque pointer Reference (computer science) Boost (C++ libraries) Automatic Reference Counting Resource acquisition is initialization (RAII) Garbage collection in computer programming References Further reading Smart Pointers - What, Why, Which?. Yonat Sharon Smart Pointers Overview. John M. Dlugosz External links countptr.hpp. The C++ Standard Library - A Tutorial and Reference by Nicolai M. Josuttis Boost Smart Pointers Smart Pointers in Delphi Smart Pointers in Rust Smart Pointers in Modern C++ Articles with example C++ code Data types