April 16, 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...
April 16, 2020
On 4/16/20 1:51 PM, H. S. Teoh wrote:
> 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!

Hehe, we all didn't think of that. I remember asking the same question I don't know how many years ago, and someone told me that answer.

It's probably somewhere in these forums...

-Steve