
On 05/10/2006 04:10 PM, David Abrahams wrote:
Larry Evans <cppljevans@cox-internet.com> 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?