Documentation Home >> Headers >> <future> Header >> std::future >> std::future::share() member function

Constructs a new std::shared_future instance and transfers ownership of the asynchronous result associated with *this to this newly constructed std::shared_future instance.

shared_future<ResultType> share();

Effects:

As-if shared_future<ResultType>(std::move(*this)).

Postconditions:

The asynchronous result associated with *this prior to the invocation of share() (if any) is associated with the newly constructed std::shared_future instance. this->valid() returns false.

Throws:

Nothing.

Header

#include <future>

See Also