Get the default hash function.
    FreeSlave via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Thu Jul 31 06:42:24 PDT 2014
    
    
  
On Thursday, 31 July 2014 at 12:05:53 UTC, francesco cattoglio 
wrote:
> Really simple question:
> how do I get the compiler-generated hash function for a given 
> type?
>
> For example:
> Struct S
> {
>     int i;
> }
>
> can be used in an associative array. That means the compiler 
> generates a "toHash" function. Is there any simple way to call 
> it directly?
I believe you may use typeid to get TypeInfo instance. It has 
getHash method - http://dlang.org/phobos/object.html#.TypeInfo
    
    
More information about the Digitalmars-d-learn
mailing list