Hello all,

I am having a hash_map with key: char *. I have defined it like this:

struct eqstr
{
  bool operator()(const char* s1, const char* s2) const
  {
    return strcmp(s1, s2) == 0;
  }
};

...
hash_map<char *,map<uint16_t,set<float>>, hash<const char *>,eqstr> symbol_hm;

but I get an error (error C2065: 'hash' : undeclared identifier) for the hash<const char *> part. How can I fix this? Which header should I include?

Thanks!

hash_map is deprecated. You should use unordered_map instead. It is a C++0x standard feature, but most compiler vendors support it already, without having to compile with the C++0x experimental support flag. Other than that, I am not familiar with std::hash, so I don't know how to solve your problem. But std::hash should be in the <utility> header.

Edited 5 Years Ago by mike_2000_17: n/a

This article has been dead for over six months. Start a new discussion instead.