reverse_iterator
default ctor should value initializeSection: 24.5.1.4 [reverse.iter.cons] Status: C++11 Submitter: Alisdair Meredith Opened: 2009-03-11 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [reverse.iter.cons].
View all issues with C++11 status.
Discussion:
Addresses UK 277
The default constructor default-initializes current, rather than value-initializes. This means that when Iterator corresponds to a trivial type, the current member is left un-initialized, even when the user explictly requests value intialization! At this point, it is not safe to perform any operations on the reverse_iterator other than assign it a new value or destroy it. Note that this does correspond to the basic definition of a singular iterator.
[ Summit: ]
Agree with option i.
Related issue: 408
[ Batavia (2009-05): ]
We believe this should be revisited in conjunction with issue 408, which nearly duplicates this issue. Move to Open.
[ 2009-07 post-Frankfurt: ]
Change "constructed" to "initialized" in two places in the proposed resolution.
Move to Tentatively Ready.
[ 2009 Santa Cruz: ]
Moved to Ready for this meeting.
Proposed resolution:
Change [reverse.iter.con]:
reverse_iterator();-1- Effects:
DefaultValue initializescurrent
. Iterator operations applied to the resulting iterator have defined behavior if and only if the corresponding operations are defined on adefault constructedvalue initialized iterator of typeIterator
.
Change [move.iter.op.const]:
move_iterator();-1- Effects: Constructs a
move_iterator
,defaultvalue initializingcurrent
. Iterator operations applied to the resulting iterator have defined behavior if and only if the corresponding operations are defined on a value initialized iterator of typeIterator
.