Default implementation of class .opEquals?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Apr 16 17:51:09 UTC 2020


On Thu, Apr 16, 2020 at 01:32:45PM -0400, Steven Schveighoffer via Digitalmars-d wrote:
> On 4/16/20 1:21 PM, H. S. Teoh wrote:
> > Just out of curiosity, is there a mixin template or something like
> > that in Phobos for implementing a default .opEquals that does
> > member-wise comparison of a class object? Something like this:
[...]
> > It's annoying to have to write an .opEquals method for every class
> > that basically just does the same thing.
> > 
> 
> This used to work:
> 
> this.tupleof == t.tupleof;

Ooh, very nice!  Why didn't I think of that. ;-)  Thanks!


T

-- 
Don't throw out the baby with the bathwater. Use your hands...


More information about the Digitalmars-d mailing list