Hash support classes to use with associative containers provided by Intel® Threading Building Blocks (Intel® TBB).
template<typename Key> struct tbb_hash_compare; template<typename Key> struct tbb_hash;
A tbb_hash_compare<Key> is the default for the HashCompare argument of template class concurrent_hash_map. A tbb_hash<Key> is the default for the Hasher argument of template classes concurrent_unordered_[multi]map, concurrent_unordered_[multi]set. The built-in definitions rely on operator== and tbb_hasher as shown in the Members description. For your own types, you can define template specializations of tbb_hash_compare or tbb_hash, or define an overload of tbb_hasher.
There are built-in definitions of tbb_hasher for the following Key types:
Types that are convertible to a size_t by static_cast<T>
Pointer types
std::basic_string
std::pair<K1,K2> where K1 and K2 are hashed using tbb_hasher.
namespace tbb { template<typename T> size_t tbb_hasher(const T&); template<typename T> size_t tbb_hasher(T*); template<typename T, typename Traits, typename Alloc> size_t tbb_hasher(const std::basic_string<T, Traits,Alloc>&); template<typename T1, typename T2> size_t tbb_hasher(const std::pair<T1,T2>& ); template<typename Key> struct tbb_hash_compare { static size_t hash(const Key& k) { return tbb_hasher(k); } static bool equal(const Key& k1, const Key& k2) { return k1==k2; } }; template<typename Key> struct tbb_hash { tbb_hash() {} size_t operator()(const Key& k) const { return tbb_hasher(k); } }; }