Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2006-05-10 17:24:44


On 05/10/2006 04:10 PM, David Abrahams wrote:
> Larry Evans <cppljevans_at_[hidden]> writes:
[snip]
>>OK, maybe I misunderstood. I thought that since operator* returns a
>>value instead of a type (obviously), that two iterators would be equal
>>only when they were the same length and each value returned by operator*
>>was equal. Is that not the case?
>
>
> Do you dereference normal STL iterators inside their comparison operators?
>
Nope, you're right. However, the reason I mentioned operator* was to
emphasize that the operators, whether * or == applied to values, not
types. The operator== applied to std::vector<I>::iterator and
std::vector<I>::iterator would probably compare an I* with an I*
and not use:

   is_same< std::vector<I>::iterator, std::vector<I>::iterator>::value

I'll admit I shouldn't have mentioned anything about length; however,
if two stl iterator's do compare equal then the operator* would
return the same value for the same number of operator++'s, wouldn't
they?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk