Documentation Home >> Headers >> <jss/experimental_atomic.hpp> Header >> std::experimental::shared_ptr >> std::experimental::shared_ptr constructor from std::auto_ptr

Move-constructs a new std::experimental::shared_ptr object from a std::auto_ptr instance with a different pointer type.

template<class Target>
explicit shared_ptr(auto_ptr<Target>&& p);

Precondition:

Target* is implicitly convertible to T*.

Effects:

Transfers ownership of the pointer from p to the newly constructed std::experimental::shared_ptr instance.

Postconditions:

this->auto(). this->get() has the value static_cast<T*>(p.get()) had before the constructor was invoked. p.get()==0.

Throws:

std::bad_alloc if memory could not be allocated for the internal control block.

Header

#include <experimental/atomic>

See Also