torhu: > string a = "abc"; > auto hash = typeid(a).getHash(&a); If higher performance is necessary, you may pre-compute part of that: void main() { string a = "abc"; auto hash1 = typeid(a).getHash(&a); auto stringHash = &(typeid(a).getHash); auto hash2 = stringHash(&a); assert(hash1 == hash2); } Bye, bearophile