2204. reverse_iterator should not require a second copy of the base iterator

Section: 27.5.1.3.4 [reverse.iter.op.star] Status: NAD Submitter: David Abrahams Opened: 2012-10-30 Last modified: 2016-02-10

Priority: Not Prioritized

View all issues with NAD status.

Discussion:

This note in 27.5.1.3.4 [reverse.iter.op.star]/2:

[ Note: This operation must use an auxiliary member variable rather than a temporary variable to avoid returning a reference that persists beyond the lifetime of its associated iterator. (See 24.2.) —end note ]

is incorrect because such iterator implementations are ruled out by 27.2.5 [forward.iterators]/6, where it says:

If a and b are both dereferenceable, then a == b if and only if *a and *b are bound to the same object.

[2013-04-20, Bristol]

Alisdair: sugested to strike the "exposition only" member.

Daniel: we must check that it wouldn't conflict with a previous solution to another issue.

Dietmar: This is an issue but the proposing word is not correct. When we have proxies inside the sequence.

Solution: NAD thanks to a contrieved example by Dietmar.

Proposed resolution:

Strike the note, 27.5.1.3.4 [reverse.iter.op.star]/2:

[ Note: This operation must use an auxiliary member variable rather than a temporary variable to avoid returning a reference that persists beyond the lifetime of its associated iterator. (See 24.2.) —end note ]