future::get Method

 

Retrieves the result that is stored in the associated asynchronous state.

Ty get();

If the result is an exception, the method rethrows it. Otherwise, the result is returned.

Before it retrieves the result, this method blocks the current thread until the associated asynchronous state is ready.

For the partial specialization future<Ty&>, the stored value is effectively a reference to the object that was passed to the asynchronous provider as the return value.

Because no stored value exists for the specialization future<void>, the method returns void.

In other specializations, the method moves its return value from the stored value. Therefore, call this method only once.

Requirements

Header: future

Namespace: std

Show: