This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++11 status.
reverse_iterator default ctor should value initializeSection: 24.5.1.4[reverse.iter.cons]Status:C++11Submitter: Alisdair MeredithOpened: 2009-03-11Last modified: 2016-01-28
Priority:Not Prioritized
View all otherissues in [reverse.iter.cons].
View all issues withC++11 status.
Discussion:
Addresses UK 277
The default constructor default-initializes current, rather thanvalue-initializes. This means that when Iterator corresponds to atrivial type, the current member is left un-initialized, even when theuser explictly requests value intialization! At this point, it is notsafe to perform any operations on the reverse_iterator other than assignit a new value or destroy it. Note that this does correspond to thebasic definition of a singular iterator.
[Summit:]
Agree with option i.
[Batavia (2009-05):]
We believe this should be revisitedin conjunction with issue408(i),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. Iteratoroperations applied to the resulting iterator have defined behavior if andonly if the corresponding operations are defined on adefault constructedvalue initializediterator of typeIterator.
Change [move.iter.op.const]:
move_iterator();-1-Effects: Constructs a
move_iterator,defaultvalueinitializingcurrent.Iteratoroperations applied to the resulting iterator have defined behavior if andonly if the corresponding operations are defined on avalue initializediterator of typeIterator.