function template

std::swap (promise)

template <class T>  void swap (promise<T>& x, promise<T>& y) noexcept;
Swap promises
Exchanges the shared states (or lack of) between x and y.

This is an overload of swap that behaves as if x.swap(y) was called.


promise objects of the same type (with the same template parameter).

Return value


Data races

Both objects, x and y, are modified.

Exception safety

No-throw guarantee: never throws exceptions.

See also