Title
Reverse iterator does not fully support targets that overload operator&
Status
c++14
Section
[reverse.iter.elem]
Submitter
Alisdair Meredith

Created on 2012-09-23.00:00:00 last changed 131 months ago

Messages

Date: 2014-02-14.16:49:03

Proposed resolution:

Revise [reverse.iter.opref] p1, as indicated:

Returns: addressof&(operator*()).

Date: 2014-02-12.00:00:00

[ 2014-02-12 Issaquah meeting ]

Use std::addressof as the library uses elsewhere, then move as Immediate.

Date: 2013-04-15.00:00:00

[ 2013-04-20, Bristol ]

Resolution: Goes to open now and move to review as soon as Daniel proposes a new wording.

Date: 2013-05-20.16:25:01

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.

History
Date User Action Args
2014-02-27 17:03:20adminsetstatus: wp -> c++14
2014-02-20 13:52:38adminsetstatus: immediate -> wp
2014-02-14 16:49:03adminsetmessages: + msg6863
2014-02-14 16:49:03adminsetstatus: open -> immediate
2013-05-20 16:25:01adminsetmessages: + msg6509
2013-05-20 16:25:01adminsetstatus: new -> open
2012-09-24 14:31:12adminsetmessages: + msg6143
2012-09-23 00:00:00admincreate