In general, the definition of tbb_hash_compare<Key> or HashCompare must provide two signatures:

A method hash that maps a Key to a size_t

A method equal that determines if two keys are equal

The signatures go together in a single class because if two keys are equal, then they must hash to the same value, otherwise the hash table might not work. You could trivially meet this requirement by always hashing to 0, but that would cause tremendous inefficiency. Ideally, each key should hash to a different value, or at least the probability of two distinct keys hashing to the same value should be kept low.

The methods of HashCompare should be static unless you need to have them behave differently for different instances. If so, then you should construct the concurrent_hash_map using the constructor that takes a HashCompare as a parameter. The following example is a variation on an earlier example with instance-dependent methods. The instance performs both case-sensitive or case-insensitive hashing, and comparison, depending upon an internal flag ignore_case.