Equality of ForwardRanges

Tobias Pankrath tobias at pankrath.net
Sun Oct 28 14:00:30 PDT 2012



I don't want to compare the contents of the range, but I'm
iterating a range and at some point I want to know if I have been
there before. Using RA I can just use indices.

>
> If you meant comparing the actual range objects using "r == 
> r.save", that doesn't hold either: If a is a "reference 
> semantic range", such as a class, then the saved range will be 
> different from the old range.
>
> Note that in both cases, this has nothing to do with RA vs Frwd.

The classes could overload opEquals to return the correct thing.
(Note: Both of my ranges have the same type). But it'd guess they
are not required to.


More information about the Digitalmars-d mailing list