Documentation Home >> Headers >> <future> Header >> std::promise >> std::promise::swap Member Function

Exchange ownership of the asynchronous results associated with two std::promise objects.

void swap(promise& other);

Effects:

Exchange ownership of the asynchronous results associated with other and *this.

Postconditions:

The asynchronous result associated with other prior to the invocation of swap (if any) is associated with *this. The asynchronous result associated with *this prior to the invocation of swap (if any) is associated with other

Throws:

Nothing.

Header

#include <future>

See Also