Array toHash()

David Held via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 29 12:45:34 PST 2014


On 11/26/2014 4:40 PM, Ali Çehreli wrote:
> [...]
>      override
>      size_t toHash() @trusted pure const nothrow
>      {
>          auto func = assumePure(&(typeid(importantStuff).getHash));
>          return func(&importantStuff);
>      }

Very helpful, thanks!  Am I right in assuming that there is some runtime 
cost here, as we are calling through a function pointer?  Is the lack of 
inlining the only cost, or is getting at the typeinfo also costly?

Dave




More information about the Digitalmars-d-learn mailing list