Documentation Home >> Headers >> <jss/experimental_atomic.hpp> Header >> std::experimental::shared_ptr >> std::shared_ptr conversion operator

Create a std::shared_ptr object that shares ownership with *this.

operator std::shared_ptr<T>() const;

Returns:

A std::shared_ptr<T> that holds the value of this->get() and shares ownership with *this.

Postconditions:

result.get()==this->get(). If this->use_count() is non zero it is increased by 1 and result.use_count()>0.

Throws:

std::bad_alloc if memory could not be allocated for any internal data structures.

Note:

If *this was constructed from a std::shared_ptr then no memory allocation may be required. The referenced object will remain valid until the last std::experimental::shared_ptr and std::shared_ptr object that references it has been destroyed or reassigned.

Header

#include <experimental/atomic>

See Also