packaged_task::get_future Method

Returns an object of type future<Ty> that has the same associated asynchronous state.

future<Ty> get_future();

Remarks

If the packaged_task object does not have an associated asynchronous state, this method throws a future_error that has an error code of no_state.

If this method has already been called for a packaged_task object that has the same associated asynchronous state, the method throws a future_error that has an error code of future_already_retrieved.

Requirements

Header: future

Namespace: std

See Also

Reference

packaged_task Class

<future>

future Class