This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.
Section: 126.96.36.199 [swappable.requirements] Status: NAD Submitter: Robert Shearer Opened: 2012-07-24 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [swappable.requirements].
View all issues with NAD status.
Paragraph 188.8.131.52 [swappable.requirements] p4 states:
An rvalue or lvalue t is swappable if and only if t is swappable with any rvalue or lvalue, respectively, of type T.
This paragraph seems to establish two disjoint definitions of "swappable" — one for lvalues and one for rvalues — with neither definition including the case of swapping an rvalue with an lvalue.Resolution proposal: Delete the word "respectively".
[ 2012-10 Portland: Close as NAD ]
The current wording does intentionally specify two families of 'swappable' behaviors, for lvalues and for rvalues, and not for mixed behavior. The need to support rvalues is for types like vector<bool>::reference. Likewise, library types like string provide a swap for values, but not a mixed-mode swap between lvalues and rvalues, which were deliberately removed from C++11 after initally being part of the standard.
Accepting this resolution would break the library specification, as no current library type would meet the new requirements.
This wording is relative to N3376.
Change 184.108.40.206 [swappable.requirements] p4 as indicated:
An rvalue or lvalue t is swappable if and only if t is swappable with any rvalue or lvalue
, respectively,of type T.