This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.
Section: 25.5.1.6 [reverse.iter.elem] Status: C++14 Submitter: Alisdair Meredith Opened: 2012-09-23 Last modified: 2021-06-06
Priority: 1
View all other issues in [reverse.iter.elem].
View all issues with C++14 status.
Discussion:
The specification for reverse_iterator::operator-> returns the address of the object yielded by dereferencing with operator*, but does not have the usual wording about returning the true address of the object. As reverse_iterator requires the adapted iterator have at least the bidirectional iterator category, we know that the returned reference is a true reference, and not a proxy, hence we can use std::addressof on the reference to get the right answer.
This will most likely show itself as an issue with a list or vector of a type with such an overloaded operator, where algorithms are likely to work with a forward iteration, but not with reverse iteration.
[2013-04-20, Bristol]
Resolution: Goes to open now and move to review as soon as Daniel proposes a new wording.
[2014-02-12 Issaquah meeting]
Use std::addressof as the library uses elsewhere, then move as Immediate.
Proposed resolution:
Revise [reverse.iter.opref] p1, as indicated:
Returns: addressof&(operator*()).