std::shared_ptr::~shared_ptr

From cppreference.com
< cpp‎ | memory‎ | shared ptr
 
 
Utilities library
Type support (basic types, RTTI, type traits)
Dynamic memory management
Error handling
Program utilities
Variadic functions
Date and time
Function objects
(C++11)
Relational operators
Optional and any
(C++17)
(C++17)
Pairs and tuples
(C++11)
(C++17)
Swap, forward and move
(C++14)
(C++11)
(C++11)
Type operations
(C++11)
(C++17)
 
 
 
~shared_ptr();

If *this owns an object and it is the last shared_ptr owning it, the object is destroyed through the owned deleter.

After the destruction, the smart pointers that shared ownership with *this, if any, will report a use_count() that is one less than its previous value.

[edit] Example

[edit] See also

destroys a weak_ptr
(public member function of std::weak_ptr)