Title
move_iterator::operator[] has wrong return type
Status
c++11
Section
[move.iter.elem]
Submitter
Doug Gregor

Created on 2008-08-21.00:00:00 last changed 162 months ago

Messages

Date: 2010-10-21.18:28:33

[ San Francisco: ]

NAD Editorial, see N2777.

Date: 2010-10-21.18:28:33

Proposed resolution:

In [move.iterator] and [move.iter.op.index], change the declaration of move_iterator's operator[] to:

reference unspecified operator[](difference_type n) const;
Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

Move to Ready. Note that if 1051 is reopened, it may yield a better resolution, but 1051 is currently marked NAD.

Date: 2009-08-15.00:00:00

[ 2009-08-15 Howard adds: ]

I recommend closing this as a duplicate of 1051 which addresses this issue for both move_iterator and reverse_iterator.

Date: 2009-07-28.00:00:00

[ 2009-07-28 Reopened by Alisdair. No longer solved by concepts. ]

Date: 2008-08-21.00:00:00

move_iterator's operator[] is declared as:

reference operator[](difference_type n) const;

This has the same problem that reverse_iterator's operator[] used to have: if the underlying iterator's operator[] returns a proxy, the implicit conversion to value_type&& could end up referencing a temporary that has already been destroyed. This is essentially the same issue that we dealt with for reverse_iterator in DR 386.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg4139
2010-10-21 18:28:33adminsetmessages: + msg4138
2010-10-21 18:28:33adminsetmessages: + msg4137
2010-10-21 18:28:33adminsetmessages: + msg4136
2010-10-21 18:28:33adminsetmessages: + msg4135
2008-08-21 00:00:00admincreate