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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.