So, simple enough question as I'm having a brain dead moment.. How can I override/replace std::hash<std::string>
to use Google's City Hash?
My current approach is to have a wrapper around std::string
and then specialize std::hash<>
for that. But this is painful as I have to implement virtually the same interface as std::string
and I want to avoid this.
You can't replace any existing specializations, i.e., you can't replace
std::hash<std::string>
. However, you can use a different hash function objects with thestd::unordered_*
containers, e.g.: