Title
constexpr swap
Status
resolved
Section
[utility.swap]
Submitter
United States

Created on 2016-11-09.00:00:00 last changed 79 months ago

Messages

Date: 2018-06-12.01:09:52

[ 2018-06 ]

Resolved by the adoption of P0879R0

Date: 2017-11-10.03:05:33

[ 2017-11 Albuquerque Thursday ]

It looks like 1581 is going to be resolved this week, so we should revisit soon.

Date: 2017-11-10.03:05:33

[ 2017-11 Albuquerque Wednesday issue processing ]

Status to Open; we don't want to do this yet; gated on Core issue 1581. See also 2897.

Date: 2017-02-02.00:41:18

[ Issues Telecon 16-Dec-2016 ]

Priority 3

Date: 2016-11-09.00:00:00

Addresses US 108

swap is a critical function in the standard library, and should be declared constexpr to support more widespread support for constexpr in libraries. This was proposed in P0202R1 which was reviewed favourably at Oulu, but the widespread changes to the <algorithm> header were too risky and unproven for C++17. We should not lose constexpr support for the much simpler (and more important) <utility> functions because they were attached to a larger paper. Similarly, the fundamental value wrappers, pair and tuple, should have constexpr swap functions, and the same should be considered for optional and variant. It is not possible to mark swap for std::array as constexpr without adopting the rest of the P0202R1 though, or rewriting the specification for array swap to not use swap_ranges.

Suggested resolution:

Adopt the changes to the <utility> header proposed in P0202R1, i.e., only bullets C, D, and E. In addition, mark the swap functions of pair and tuple as constexpr, and consider doing the same for optional and variant.

History
Date User Action Args
2018-06-12 01:09:52adminsetmessages: + msg9895
2018-06-12 01:09:52adminsetstatus: open -> resolved
2017-11-10 03:05:33adminsetmessages: + msg9533
2017-11-10 03:05:33adminsetmessages: + msg9532
2017-11-10 03:05:33adminsetstatus: new -> open
2016-12-16 20:56:38adminsetmessages: + msg8730
2016-11-09 00:00:00admincreate