##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::shared_ptr::~shared_ptr

From cppreference.com
< cpp‎ | memory‎ | shared ptr

~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] Notes

Unlike std::unique_ptr, the deleter of std::shared_ptr is invoked even if the managed pointer is null.

### [edit] Example

| This section is incomplete Reason: no example

### [edit] See also

(destructor) | destroys a `weak_ptr` (public member function of `std::weak_ptr`) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/memory/shared_ptr/%7Eshared_ptr&oldid=90105"
Category:

- Todo no example