Created on 2007-06-11.00:00:00 last changed 171 months ago
Proposed resolution:
Change the synopsis in [move.iterator]:
typedeftypename iterator_traits<Iterator>::pointerpointer;
move_iterator's operator-> return type pointer does not consistently match the type which is returned in the description in [move.iter.op.ref].
template <class Iterator> class move_iterator { public: ... typedef typename iterator_traits<Iterator>::pointer pointer; ... pointer operator->() const {return current;} ... private: Iterator current; // exposition only };
There are two possible fixes.
The first solution is the one chosen by reverse_iterator. A potential disadvantage of this is it may not work well with iterators which return a proxy on dereference and that proxy has overloaded operator&(). Proxy references often need to overloaad operator&() to return a proxy pointer. That proxy pointer may or may not be the same type as the iterator's pointer type.
By simply returning the Iterator and taking advantage of the fact that the language forwards calls to operator-> automatically until it finds a non-class type, the second solution avoids the issue of an overloaded operator&() entirely.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg3423 |
2007-06-11 00:00:00 | admin | create |