Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2464 Discussions

concurrent_hash_map with key as const char*

bnand
Beginner
262 Views

Hi,

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.

Thanks

0 Kudos
1 Reply
RafSchietekat
Valued Contributor III
262 Views
Sorry for stating the obvious, but you only mention MyHashCompare::hash(), and not its equal() function: does it use == or !strcmp()?
0 Kudos
Reply