Topic: N2284 Defect: reverse_iterator/move_iterator difference has invalid signatures
Author: "Bo Persson" <bop@gmb.dk>
Date: Sun, 10 Jun 2007 20:56:30 CST Raw View
In C++03 the difference between two reverse_iterators
ri1 - ri2
is possible to compute only if both iterators have the same base
iterator. The result type is the difference_type of the base iterator.
In the current draft, the operator is defined as [reverse.iter.opdiff]
template<class Iterator1, class Iterator2>
typename reverse_iterator<Iterator>::difference_type
operator-(const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
The return type is the same as the C++03 one, based on the no longer
present Iterator template parameter.
Besides being slightly invalid, should this operator work only when
Iterator1 and Iterator2 has the same difference_type? Or should the
implementation choose one of them? Which one?
The same problem now also appears in operator-() for move_iterator
[move.iter.nonmember].
Bo Persson
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]