22 #ifndef __TBB_tbb_hash_compare_impl_H 23 #define __TBB_tbb_hash_compare_impl_H 28 namespace interface5 {
32 template<
typename Key,
typename Hasher,
typename Key_equality>
36 typedef Hasher hasher;
37 typedef Key_equality key_equal;
41 hash_compare(Hasher a_hasher) : my_hash_object(a_hasher) {}
43 hash_compare(Hasher a_hasher, Key_equality a_keyeq) : my_hash_object(a_hasher), my_key_compare_object(a_keyeq) {}
45 size_t operator()(
const Key& key)
const {
46 return ((
size_t)my_hash_object(key));
49 bool operator()(
const Key& key1,
const Key& key2)
const {
50 return (!my_key_compare_object(key1, key2));
53 Hasher my_hash_object;
54 Key_equality my_key_compare_object;
58 static const size_t hash_multiplier = tbb::internal::select_size_t_constant<2654435769U, 11400714819323198485ULL>::value;
64 inline size_t tbb_hasher(
const T& t ) {
65 return static_cast<size_t>( t ) * internal::hash_multiplier;
68 inline size_t tbb_hasher( P* ptr ) {
69 size_t const h =
reinterpret_cast<size_t>( ptr );
72 template<
typename E,
typename S,
typename A>
73 inline size_t tbb_hasher(
const std::basic_string<E,S,A>& s ) {
75 for(
const E* c = s.c_str(); *c; ++c )
76 h = static_cast<size_t>(*c) ^ (h * internal::hash_multiplier);
79 template<
typename F,
typename S>
80 inline size_t tbb_hasher(
const std::pair<F,S>& p ) {
81 return tbb_hasher(p.first) ^ tbb_hasher(p.second);
85 using interface5::tbb_hasher;
88 template<
typename Key>
94 size_t operator()(
const Key& key)
const 96 return tbb_hasher(key);
101 template<
typename Key>
103 static size_t hash(
const Key& a ) {
return tbb_hasher(a); }
104 static bool equal(
const Key& a,
const Key& b ) {
return a == b; }
Definition: _tbb_hash_compare_impl.h:89
Definition: _flow_graph_async_msg_impl.h:32
The namespace tbb contains all components of the library.
Definition: parallel_for.h:44
Definition: _tbb_hash_compare_impl.h:33
hash_compare that is default argument for concurrent_hash_map
Definition: _tbb_hash_compare_impl.h:102