swap Function (<future>)

Exchanges the associated asynchronous state of one promise object with that of another.

template<class Ty>
   void swap(promise<Ty>& Left, promise<Ty>& Right) noexcept;
template<class Ty, class... ArgTypes>
   void swap(packaged_task<Ty(ArgTypes...)>& Left,
      packaged_task<Ty(ArgTypes...)>& Right) noexcept;

Parameters

  • Left
    The left promise object.

  • Right
    The right promise object.

Requirements

Header: future

Namespace: std

See Also

Reference

promise Class

<future>