Documentation Home >> Headers >> <future> Header >> std::packaged_task >> std::packaged_task::reset Member function

Associate a std::packaged_task instance with a new asynchronous result for the same task.

void reset();

Preconditions:

*this has an associated asynchronous task.

Effects:

Allocate a new asynchronous result for the task associated with *this.

Postconditions:

If the asynchronous result associated with *this prior to the call is not ready, that asynchronous result is ready with a stored exception of type std::future_error and an error code of std::future_errc::broken_promise. *this has a new asynchronous result with no associated futures, and which is not ready.

Throws:

An exception of type std::bad_alloc if memory could not be allocated for the new asynchronous result.

Header

#include <future>

See Also