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

Section: 24.5.1.6 [reverse.iter.elem] Status: NAD Submitter: David Abrahams Opened: 2012-10-30 Last modified: 2021-06-06

Priority: Not Prioritized

View all other issues in [reverse.iter.elem].

View all issues with NAD status.

Discussion:

This note in [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 24.3.5.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, [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 ]