Title
MoveConstructible and MoveAssignable need clarification of moved-from state
Status
resolved
Section
[utility.arg.requirements]
Submitter
Howard Hinnant

Created on 2009-12-12.00:00:00 last changed 163 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change the follwing tables in [utility.arg.requirements] as shown:

Table 33 — MoveConstructible requirements [moveconstructible]
Expression Post-condition
T t(rv) t is equivalent to the value of rv before the construction.
[Note: There is no requirement on the value of rv after the construction. rv remains a valid object. Its state is unspecified.end note]
Table 35 — MoveAssignable requirements [moveassignable]
Expression Return type Return value Post-condition
t = rv T& t t is equivalent to the value of rv before the assigment.
[Note: There is no requirement on the value of rv after the assignment. rv remains a valid object. Its state is unspecified.end note]
Date: 2010-10-21.18:28:33

Rationale:

This issue is now addressed by 1309.

Date: 2010-02-10.00:00:00

[ 2010-02-10 Moved to Tentatively NAD EditorialResolved after 5 postive votes on c++std-lib. Rationale added below. ]

Date: 2010-02-10.00:00:00

[ 2010-02-10 Reopened. The wording here has been merged into 1309. ]

Date: 2010-01-23.00:00:00

[ 2010-01-23 Alisdair opens: ]

I'm afraid I must register an objection.

My primary objection is that I have always been opposed to this kind of a resolution as over-constraining. My preferred example is a call implementing the pImpl idiom via unique_ptr. Once the pImpl has been moved from, it is no longer safe to call the vast majority of the object's methods, yet I see no reason to make such a type unusable in the standard library. I would prefer a resolution along the lines suggested in the UK comment, which only requires that the object can be safely destroyed, and serve as the target of an assignment operator (if supported.)

However, I will not hold the issue up if I am a lone dissenting voice on this (yes, that is a call to hear more support, or I will drop that objection in Pittsburgh)

With the proposed wording, I'm not clear what the term 'valid object' means. In my example above, is a pImpl holding a null pointer 'valid'? What about a float holding a signalling NaN? What determines if an object is valid? Without a definition of a valid/invalid object, I don't think this wording adds anything, and this is an objection that I do want resolved.

2010-01-24 Alisdair removes his objection. 2010-01-24 Moved to Tentatively Ready after 5 positive votes on c++std-lib.
Date: 2010-01-22.00:00:00

[ 2010-01-22 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]

Date: 2010-01-22.00:00:00

[ 2010-01-22 Wording tweaked by Beman. ]

Date: 2009-12-12.00:00:00

Addresses UK 150

There is on going confusion over what one can and can not do with a moved-from object (e.g. UK 150, 910). This issue attempts to clarify that moved-from objects are valid objects with an unknown state.

History
Date User Action Args
2010-11-19 19:04:45adminsetstatus: nad editorial -> resolved
2010-10-21 18:28:33adminsetmessages: + msg1445
2010-10-21 18:28:33adminsetmessages: + msg1444
2010-10-21 18:28:33adminsetmessages: + msg1443
2010-10-21 18:28:33adminsetmessages: + msg1442
2010-10-21 18:28:33adminsetmessages: + msg1441
2010-10-21 18:28:33adminsetmessages: + msg1440
2010-10-21 18:28:33adminsetmessages: + msg1439
2009-12-12 00:00:00admincreate