How do I obtain the default hash of a user-defined struct

bearophile bearophileHUGS at lycos.com
Fri Apr 4 10:22:48 PDT 2014


H. S. Teoh:

> This means that the hash of MyKey is computed based on its 
> binary
> representation, disregarding the contents of any array (and 
> other
> reference) fields. This will certainly break AA's.
>
> I'm almost certain this has already been reported as a bug, but 
> I
> vaguely remember someone mentioning a while back that this is 
> supposed
> to have been fixed. But I still get the above problem in DMD 
> git HEAD.
> :-(

It needs to be fixed. (Or the code should not compile).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list