Title
"swappable" undefined for swapping lvalue and rvalue
Status
nad
Section
[swappable.requirements]
Submitter
Robert Shearer

Created on 2012-07-24.00:00:00 last changed 140 months ago

Messages

Date: 2012-10-16.15:35:12

Proposed resolution:

This wording is relative to N3376.

Change [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.

Date: 2012-10-16.15:35:12

[ 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.

Date: 2012-07-24.00:00:00

Paragraph [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".

History
Date User Action Args
2012-10-16 15:35:12adminsetmessages: + msg6177
2012-10-16 15:35:12adminsetstatus: new -> nad
2012-08-11 20:22:19adminsetmessages: + msg6111
2012-07-24 00:00:00admincreate