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

Created on 2016-07-19.00:00:00 by admin, last changed by admin.

msg8270 (view) 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.

msg8242 (view) Date: 2016-08-06.21:31:18

[ 2016-07 Chicago ]

Monday: P0 - tentatively ready

msg8241 (view) 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.

Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> open
2017-06-15 20:54:10adminsetsection: [optional.object.swap][optional.specalg] -> [optional.swap][optional.specalg]
2016-11-14 03:59:28adminsetstatus: open -> wp
2016-11-14 03:55:22adminsetstatus: ready -> open
2016-08-01 18:34:48adminsetstatus: new -> ready
2016-08-01 18:34:48adminsetmessages: + msg8270
2016-07-26 18:35:27adminsetmessages: + msg8242
2016-07-19 00:00:00admincreate