This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.
Section: 20.2.2 [utility.swap] Status: Resolved Submitter: United States Opened: 2016-11-09 Last modified: 2020-09-06
View all other issues in [utility.swap].
View all issues with Resolved status.
Addresses US 108swap 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.
[Issues Telecon 16-Dec-2016]
[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.
[2017-11 Albuquerque Thursday]
It looks like 1581 is going to be resolved this week, so we should revisit soon.
Resolved by the adoption of P0879R0