opEquals does not work?

Jonathan M Davis jmdavisProg at gmx.com
Fri Jun 7 14:18:01 PDT 2013


On Friday, June 07, 2013 22:51:12 Namespace wrote:
> I got it. I must use Object instead of A... How ridiculous. I
> thought this was already fixed...

I have an open pull request as part of the move to getting rid of opEquals, 
opCmp, toHash, and toString from Object, and it would make it so that you 
could use something other than Object:

https://github.com/D-Programming-Language/druntime/pull/459

However, due to D's overload rules, you will _always_ be forced to have an 
opEquals which takes the most base class that you can compare. But you should 
be able to do something like overload it with the derived class type and then 
alias the base classes' opEquals into the scope of the derived class.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list