pair copy-assignment not consistent for referencesSection: 22.3.2 [pairs.pair] Status: Resolved Submitter: INCITS Opened: 2010-08-25 Last modified: 2016-01-28
Priority: Not Prioritized
View other active issues in [pairs.pair].
View all other issues in [pairs.pair].
View all issues with Resolved status.
Discussion:
Addresses US-95
Copy-assignment for pair is defaulted and does not work
for pairs with reference members. This is inconsistent with
conversion-assignment, which deliberately succeeds even
if one or both elements are reference types, just as for
tuple. The copy-assignment operator should be
consistent with the conversion-assignment operator and
with tuple's assignment operators.
[ 2010-10-24 Daniel adds: ]
Accepting n3140 would provide a superior resolution, because
pairdoes not depend on the semantic requirements ofCopyAssignable.
[ 2010-11 Batavia ]
Resolved by adopting n3140.
Proposed resolution:
Add to pair synopsis:
pair& operator=(const pair& p);
Add before paragraph 9:
pair& operator=(const pair& p);Requires:
T1andT2shall satisfy the requirements ofCopyAssignable.Effects: Assigns
p.firsttofirstandp.secondtosecond. Returns:*this.