Associative arrays, opCmp, opEquals and toHash in 2.066.0-b4

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 21 05:49:45 PDT 2014


Jacob Carlborg:

> "Error: AA key type TagIndex now requires equality rather than 
> comparison"

Hashing protocol has being finally fixed.


> What exactly do I need to define to have a struct with two ints 
> working as a key in an associative array?

opEquals and opHash. But if your struct has only two ints as 
fields, it should work even if you don't define both methods.

Bye,
bearophile


More information about the Digitalmars-d mailing list