Title
swappable traits for optionals
Status
c++17
Section
[optional.swap][optional.specalg]
Submitter
Agustín K-ballo Bergé

Created on 2016-07-19.00:00:00, last changed 2017-07-30.20:15:43.

Messages

Date: 2016-08-01.18:34:48

Proposed resolution:

This wording is relative to N4606.

  1. Modify [optional.object.swap] as indicated:

    void swap(optional<T>& rhs) noexcept(see below);
    

    […]

    -4- Remarks: The expression inside noexcept is equivalent to:

    is_nothrow_move_constructible_v<T> && is_nothrow_swappable_v<T>noexcept(swap(declval<T&>(), declval<T&>()))
    
  2. Modify [optional.specalg] as indicated:

    template <class T> void swap(optional<T>& x, optional<T>& y) noexcept(noexcept(x.swap(y)));
    

    -1- Effects: Calls x.swap(y).

    -?- Remarks: This function shall not participate in overload resolution unless is_move_constructible_v<T> is true and is_swappable_v<T> is true.

Date: 2016-08-01.18:34:48

[ 2016-07 Chicago ]

Monday: P0 - tentatively ready

Date: 2016-07-19.00:00:00

optional didn't benefit from the wording modifications by P0185 "Adding [nothrow_]swappable traits"; as such, it suffers from LWG 2456, and does not play nice with swappable traits.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-11-14 03:59:28adminsetstatus: pending -> wp
2016-11-14 03:55:22adminsetstatus: ready -> pending
2016-08-01 18:34:48adminsetmessages: + msg8265
2016-08-01 18:34:48adminsetstatus: new -> ready
2016-07-26 18:35:27adminsetmessages: + msg8234
2016-07-19 00:00:00admincreate