Template:cpp/experimental/future/then

Attach the continuation to. The behavior is undefined if has no associated shared state (i.e., ).

Creates a shared state associated with the object to be returned, and a copy  of  constructed as if by  evaluated in the thread calling, where  is defined as

When the shared state currently associated with is ready, the continuation  is called on an unspecified thread of execution, where  is the operation defined in. If that expression is invalid, the behavior is undefined.

Any value returned from the continuation is stored as the result in the shared state of the returned object. Any exception propagated from the execution of the continuation is stored as the exceptional result in the shared state of the returned object.

Let be the return type of the continuation (i.e. ). If  is  for some type, then the return type of  is , otherwise it is. This is known as implicit unwrapping.

If implicit unwrapping takes place and the continuation returns an invalid, then the shared state is made ready with an exception of type std with an error condition of std.

After this function returns, is.

Return value
A std object associated with the shared state created by this object. for the returned object.