Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
2417 Discussions

concurrent_hash_map with key as const char*

bnand
Beginner
131 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
Black Belt
131 Views
Sorry for stating the obvious, but you only mention MyHashCompare::hash(), and not its equal() function: does it use == or !strcmp()?
Reply