In C ++, there is a default hash function std::hash<T> for the simplest types, for example std::string , int , etc. I believe that these functions have good entropy and the corresponding random variable distribution is statistically uniform. If this is not so, then let it pretend to be so.
Then I have a structure:
struct CustomType { int field1; short field2; string field3;
I want to use it using separate hashes of some of its fields, say std::hash(field1) and std::hash(field2) . Both hashes are in the set of possible values ββof type size_t .
What is a good hash function that can combine both of these results and map them back to size_t ?
source share