Implement ISO/IEC TS 19571:2016 future<T>
.
Constructors
future
future
Creates a new future that unwraps rhs
.
This constructor creates a new shared state that becomes satisfied when both rhs
and rhs.get()
become satisfied. If rhs
is satisfied, but rhs.get()
returns an invalid future then the newly created future becomes satisfied with a std::future_error
exception, and the exception error code is std::future_errc::broken_promise
.
Note:The technical specification requires this to be a
noexceptconstructor I (coryan) believe this is a defect in the technical specification, as this creates a new shared state: shared states are dynamically allocated, and the allocator (which might be the defaultoperator new) may raise.
rhs
future< future< T > > &&
future
Creates a future from a future whose result type is convertible to this future's result type.
rhs
future< U > &&
class U
typename Enable
future
state
std::shared_ptr< shared_state_type >
Functions
get
Waits until the shared state becomes ready, then retrieves the value stored in the shared state.
Note:This operation invalidates the future, subsequent calls will fail, the application should capture the returned value because it would.
T
then
Attach a continuation to the future.
Attach a callable func to be invoked when the future is ready. The return type is a future wrapping the return type of func .
Side effects: valid() == false
if the operation is successful.
func
F &&
a Callable to be invoked when the future is ready. The function might be called immediately, e.g., if the future is ready.
typename F
internal::then_helper< F, T >::future_t

