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

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

packaged_task& operator=(packaged_task&& other);

Effects:

Transfer ownership of the asynchronous result and task 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 and task associated with other prior to the invocation of the move-assignment operator is associated with the *this. other has no associated asynchronous result or task.

Returns:

*this

Throws:

Nothing.

Header

#include <future>

See Also