Documentation Home >> Headers >> <jss/experimental_atomic.hpp> Header >> std::experimental::shared_ptr >> std::experimental::shared_ptr destructor

Destroys a std::experimental::shared_ptr object, and decreases the count on the owned pointer.

~shared_ptr() noexcept;

Postconditions:

If this->unique() would have returned true prior to the invocation of the destructor, destroy the owned object by calling d(p) where d is the deleter for the owned object and p is the pointer passed to the constructor, or the address of the object constructed with make_shared non-member function. If no deleter was supplied, the owned object is destroyed with delete p. Otherwise, if this->use_count() was more than 1, decrease the value returned by the use_count member function on other std::experimental::shared_ptr instances that own the same object.

Note:

The original pointer p may be a different type to the value owned by *this if pointer conversions or the std::experimental::shared_ptrAliasing constructor have been used.

Throws:

Nothing.

Header

#include <experimental/atomic>

See Also