It seems as if C++ does not have a hash function for strings in the standard library. Is this true?
What is a working example of using a string as a key in an unordered_
I ran into this today (actually with wstring
, not string
, but it's the same deal): using wstring
as a key in an unordered_map
generates an error about no hash function being available for that type.
The solution for me was to add:
#include
Believe it or not, without the #include
directive I still had the wstring
type available but apparently NOT the ancillary functions like the hash. Simply adding the include above fixed it.