recursive equal, and firstDifference functions

monarch_dodra monarchdodra at gmail.com
Tue Mar 19 05:34:03 PDT 2013


On Tuesday, 19 March 2013 at 12:11:50 UTC, bearophile wrote:
> Jonathan M Davis:
>
>> Going beyond a range of ranges is likely to be quite rare,
>
> I agree.
>
>
>> and when it does happen, you can simply nest equal as many 
>> times as you need.
>
> A similar function seems useful for Phobos because it's 
> automatic, you don't need to tell it how many levels there are.
>
> Bye,
> bearophile

But the compiler can't tell how many levels deep you want to go. 
There are legitimate cases of "Range of Stuff" where Stuff just 
so happens to be a range, but you don't want range comparison.

For example:
class MyClassRange;

MyClassRange a, b;

SuperEqual(a, b); //?

I think using equal!equal is not that much more verbose, but 
safer/explicit.


More information about the Digitalmars-d-learn mailing list