Getting the hash of any value easily?
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 30 18:07:57 PDT 2014
A coworker asked about the idiomatic way to get the hash of a string in
D, and somewhat surprisingly the best answer I could find is: "to get
the hash of an lvalue x, call typeof(x).getHash(&x)."
That's admittedly quite clunky and indirect. Is it worth it to simplify
that by means of a template in object.di?
Andrei
More information about the Digitalmars-d
mailing list