1088. std::promise should provide non-member swap overload

Section: 33.6.6 [futures.promise] Status: Resolved Submitter: Howard Hinnant Opened: 2009-03-22 Last modified: 2016-02-10

Priority: Not Prioritized

View other active issues in [futures.promise].

View all other issues in [futures.promise].

View all issues with Resolved status.

Discussion:

Addresses UK 342 [CD1]

std::promise is missing a non-member overload of swap. This is inconsistent with other types that provide a swap member function.

Add a non-member overload void swap(promise&& x,promise&& y){ x.swap(y); }

[ Summit: ]

Create an issue. Move to review, attention: Howard. Detlef will also look into it.

[ Post Summit Daniel provided wording. ]

[ 2009-10 Santa Cruz: ]

NAD EditorialResolved. Addressed by N2997.

Proposed resolution:

  1. In 33.6.6 [futures.promise], before p.1, immediately after class template promise add:

    
    template <class R>
    void swap(promise<R>& x, promise<R>& y);
    
    
  2. Change 33.6.6 [futures.promise]/10 as indicated (to fix a circular definition):

    -10- Effects: swap(*this, other)Swaps the associated state of *this and other

    Throws: Nothing.

  3. After the last paragraph in 33.6.6 [futures.promise] add the following prototype description:

    
    template <class R>
    void swap(promise<R>& x, promise<R>& y);
    

    Effects: x.swap(y)

    Throws: Nothing.