Hello,
is it reasonable, that most stl-implementations allow conversion from
iterator to const_iterator via conversion constructors like the following?
template<class _Other>
reverse_iterator(const reverse_iterator<_Other>& _Right);
This signature unfortunately allows the other direction, wich is
semantically surely not the desired thing. GCC for example uses this way
not only for reverse_iterators.
I wrote equality comparison operators for reseverse iterators nad
const_reverse_iterators (see thread "reverse iterator operator==") and here
the trouble starts. Greenly, as I sometimes act, I wrote twice operator==()
(and twice operator!=):
template <typename Iter> // typename Const<Iter>::type is the const version
bool // of iterator type Iter. Some little magic :-).
operator==(const std::reverse_iterator<typename Const<Iter>::type> &lhs,
const std::reverse_iterator<Iter> &lhs);
template <typename Iter>
bool
operator==(const std::reverse_iterator<Iter> &lhs,
const std::reverse_iterator<typename Const<Iter>::type> &lhs);
and of course this yields ambiguity !!!
Tell me, what do you think of these STL reverse_iterator implementation. IMO
thei are doing it the easy way, allowing any reverse_iterator to be
converted to any other reverse_iterator. Even more, some allow this for
normal iterators, too. Doesn't this provoke trouble,
regards,
alex