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

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

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

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->use_count() has the value p.use_count() had before the constructor was invoked, and this->get() has the value static_cast<T*>(p.get()) had before the constructor was invoked. p.get()==0, p.use_count()==0.

Throws:

Nothing.

Header

#include <experimental/atomic>

See Also