Comparing Instances of Classes

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 10 08:47:47 PST 2017


On Friday, 10 March 2017 at 16:36:17 UTC, DRex wrote:
> I'm fairly new to D, but this seems to be quite a pain in the 
> rear for a simple comparison of instances of classes...really 
> odd that comparing instances of classes in D requires that 
> messing around when D seems all about simplifying things...

There often is no sensible default comparison for class contents 
(now structs on the other hand do have a default comparison that 
usually works, but structs don't have to worry about 
polymorphism), so you just need to specify what fields actually 
matter to your code...


More information about the Digitalmars-d-learn mailing list