function template

std::swap (packaged_task)

template <class Ret, class... Args>
  void swap (packaged_task<Ret(Args...)>& x, packaged_task<Ret(args...)>& y) noexcept;
Swap packaged_task
Exchanges the shared states and stored tasks between x and y.

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


packaged_task objects of the same type (with the same template parameters).

Return value


Data races

Both objects, x and y, are modified.

Exception safety

No-throw guarantee: never throws exceptions.

See also