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

Construct a new std::experimental::shared_ptr object that shares ownership the supplied std::experimental::shared_ptr instance and holds the supplied pointer

template<class Other>
shared_ptr(shared_ptr<Other> const& sp,T* p) noexcept;

Effects:

If sp.use_count()>0, construct a new std::experimental::shared_ptr instance that shares ownership with sp and holds the value p. Otherwise constructs a new empty std::experimental::shared_ptr instance that holds the value p.

Postconditions:

this->use_count()==sp.use_count(). !this->owner_before(sp). !sp.owner_before(*this). this->get()==p for the newly-constructed std::experimental::shared_ptr object. If sp.use_count()>0 before the constructor invocation then sp.use_count() is increased by 1.

Throws:

Nothing.

Note:

This constructor allows construction of an empty std::experimental::shared_ptr with a non-null value.

Header

#include <experimental/atomic>

See Also