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

Constructs a new std::experimental::weak_ptr object that has weak ownership of the pointer held in a std::experimental::shared_ptr instance.

template<typename Target>
weak_ptr(shared_ptr<Target> const& p) noexcept;

Preconditions:

Target* is implicitly convertible to T*.

Effects:

Constructs a new std::experimental::weak_ptr instance with the value held by the std::experimental::shared_ptr that shares ownership with the std::experimental::shared_ptr.

Postconditions:

this->use_count()==p.use_count(). !this->owner_before(p). !p.owner_before(*this).

Throws:

Nothing.

Header

#include <experimental/atomic>

See Also