# tbb_hash_compare Class

## Summary

Default `HashCompare` for `concurrent_hash_map`.

## Syntax

    template<typename Key> struct tbb_hash_compare;

## Header

    #include "tbb/concurrent_hash_map.h"

## Description

A `tbb_hash_compare<Key>` is the default for the `HashCompare` argument of template class`concurrent_hash_map`. The built-in definition relies on `operator==` and `tbb_hasher` as shown in the Members description. For your own types, you can define a template specialization of `tbb_hash_compare` 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`.

## Members

     namespace tbb {
            template<typename Key>
            struct tbb_hash_compare {
                static size_t hash(const Key& a) {
                    return tbb_hasher(a);
                }
                static bool equal(const Key& a, const Key& b) {
                    return a==b;
                }
            };

            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>& );
                };

Parent topic: concurrent_hash_map Template Class