Documentation Home >> Headers >> <jss/experimental_atomic.hpp> Header >> std::experimental::shared_ptr >> std::experimental::shared_ptr nullptr constructor with a deleter

Construct a new std::experimental::shared_ptr object that owns a null pointer and deleter.

template<class Deleter>
explicit shared_ptr(nullptr_t p,Deleter d);

Precondition:

Deleter is CopyConstructible.

Effects:

Construct a new std::experimental::shared_ptr instance that owns p and a copy of d.

Postconditions:

If sp is the newly-constructed std::experimental::shared_ptr object, sp.unique() and sp.get()==nullptr and get_deleter<Deleter>(sp)!=0.

Note:

This allows you to construct a std::experimental::shared_ptr for which get member function is nullptr, but use_count member function is non-zero.

Throws:

std::bad_alloc if memory for the internal data structures of std::experimental::shared_ptr could not be allocated.

Note:

If an exception is thrown, d(p) is invoked.

Header

#include <experimental/atomic>

See Also