Created on 2013-09-24.00:00:00 last changed 36 months ago
Notes from the October, 2015 meeting:
See also paper P0137 and issue 2182.
[Adopted at the June, 2016 meeting as document P0137R1.]N3690 comment FI 15
The rules given in 6.7.3 [basic.life] paragraph 7 for when an object's lifetime can be ended and a new object created in its storage include the following restriction:
the type of the original object is not const-qualified, and, if a class type, does not contain any non-static data member whose type is const-qualified or a reference type
The intent of this restriction is to permit optimizers to rely upon the original values of const and reference members in their analysis of subsequent code. However, this makes it difficult to implement certain desirable functionality such as optional<T>; see this discussion for more details.
This rule should be reconsidered, at least as far as it applies to unions. If it is decided to keep the rule, acceptable programming techniques for writing safe code when replacing such objects should be outlined in a note.
(See also issue 1404, which will become moot if the restriction is lifted.)
|2018-02-27 00:00:00||admin||set||messages: + msg6152|
|2017-02-06 00:00:00||admin||set||status: drafting -> cd4|
|2015-11-10 00:00:00||admin||set||messages: + msg5639|
|2014-03-03 00:00:00||admin||set||status: open -> drafting|