Documentation Home >> Headers >> <jss/experimental_future.hpp> Header >> std::experimental::future >> std::experimental::future<>::get Member function

If the associated state contains a deferred function from a call to std::experimental::async then invoke that function and return the result, otherwise wait until the asynchronous result associated with an instance of std::experimental::future is ready, and then return the stored value or throw the stored exception.

void future<void>::get();
R& future<R&>::get();
R future<R>::get();

Preconditions:

this->valid() would return true.

Effects:

If the state associated with *this contains a deferred function, invoke the deferred function and return the result or propagate any thrown exception.

Otherwise, block until the asynchronous result associated with *this is ready. If the result is a stored exception then throw that exception. Otherwise return the stored value.

Returns:

If the associated state contains a deferred function then the result of the function invocation. Otherwise, if ResultType is void then return normally. If ResultType is R& for some type R then return the stored reference. Otherwise, return the stored value.

Throws:

The exception thrown by the deferred exception, or stored in the asynchronous result, if any.

Postcondition:

this->valid()==false

Header

#include <experimental/future>

See Also