concurrent_hash_map with key as const char*

concurrent_hash_map with key as const char*


I am trying to use concurrent hash map with the key type being "const char*", like, concurrent_hash_map.

I make sure that the pointer to the key is not destroyed so long as the hash key is not erased from the map. MyHashCompare hash function hashes the null terminated string pointed to by the key pointer.

The problem I am facing is that my lookup is always failing. It appears that the hsah_map is looking up the actual pointer instead of hashing on the key value.

This works on std::hash_map. I know I can change it so that the key values are std::strings, but want to avoid construction/destruction and copying.

I am using the version tbb20_20080408oss_src.

Appreciate any help.


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Sorry for stating the obvious, but you only mention MyHashCompare::hash(), and not its equal() function: does it use == or !strcmp()?

Leave a Comment

Please sign in to add a comment. Not a member? Join today