What is the default hash function used in C++ std::unordered_map?
问题 I am using unordered_map<string, int> and unordered_map<int, int> What hash function is used in each case and what is chance of collision in each case? I will be inserting unique string and unique int as keys in each case respectively. I am interested in knowing the algorithm of hash function in case of string and int keys and their collision stats. 回答1: The function object std::hash<> is used. Standard specializations exist for all built-in types, and some other standard library types such