Section: 16.4.4.3 [swappable.requirements] Status: NAD Submitter: Robert Shearer Opened: 2012-07-24 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [swappable.requirements].
View all issues with NAD status.
Discussion:
Paragraph 16.4.4.3 [swappable.requirements] p4 states:
An rvalue or lvalue
t
is swappable if and only ift
is swappable with any rvalue or lvalue, respectively, of typeT
.
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.
Proposed resolution:
This wording is relative to N3376.
Change 16.4.4.3 [swappable.requirements] p4 as indicated:
An rvalue or lvalue
t
is swappable if and only ift
is swappable with any rvalue or lvalue, respectively,of typeT
.