Documentation Home >> Headers >> <future> Header >> std::promise >> std::promise Move-Assignment Operator

Transfer ownership of the asynchronous result associated with one std::promise object to another.

promise& operator=(promise&& other);

Effects:

Transfer ownership of the asynchronous result associated with other to *this. If *this already had an associated asynchronous result, that asynchronous result is made ready with an exception of type std::future_error, and an error code of std::future_errc::broken_promise.

Postconditions:

The asynchronous result associated with other prior to the invocation of the move-assignment operator is associated with the *this. other has no associated asynchronous result.

Returns:

*this

Throws:

Nothing.

Header

#include <future>

See Also