20 #ifndef __TBB_concurrent_unordered_map_H 21 #define __TBB_concurrent_unordered_map_H 28 namespace interface5 {
31 template<
typename Key,
typename T,
typename Hash_compare,
typename Allocator,
bool Allow_multimapping>
39 #if __TBB_UNORDERED_NODE_HANDLE_PRESENT 43 #endif // __TBB_UNORDERED_NODE_HANDLE_PRESENT 50 template<
class Type1,
class Type2>
58 template<
typename Key,
typename T,
typename Hasher,
typename Key_equality,
typename Allocator>
61 template <
typename Key,
typename T,
typename Hasher = tbb::tbb_hash<Key>,
typename Key_equality = std::equal_to<Key>,
62 typename Allocator = tbb::tbb_allocator<std::pair<const Key, T> > >
64 public internal::concurrent_unordered_base< concurrent_unordered_map_traits<Key, T,
65 internal::hash_compare<Key, Hasher, Key_equality>, Allocator, false> >
68 typedef internal::hash_compare<Key, Hasher, Key_equality>
hash_compare;
70 typedef internal::concurrent_unordered_base< traits_type >
base_type;
74 using traits_type::allow_multimapping;
77 using base_type::find;
78 using base_type::insert;
89 typedef typename base_type::pointer
pointer;
101 #if __TBB_UNORDERED_NODE_HANDLE_PRESENT 103 #endif // __TBB_UNORDERED_NODE_HANDLE_PRESENT 107 const hasher& a_hasher = hasher(),
const key_equal& a_keyeq = key_equal(),
109 : base_type(n_of_buckets, key_compare(a_hasher, a_keyeq), a)
113 : base_type(n_of_buckets, key_compare(hasher(), key_equal()), a)
117 : base_type(n_of_buckets, key_compare(a_hasher, key_equal()), a)
123 template <
typename Iterator>
125 const hasher& a_hasher = hasher(),
const key_equal& a_keyeq = key_equal(),
127 : base_type(n_of_buckets, key_compare(a_hasher, a_keyeq), a)
132 template <
typename Iterator>
134 : base_type(n_of_buckets, key_compare(hasher(), key_equal()), a)
139 template <
typename Iterator>
141 const allocator_type& a)
142 : base_type(n_of_buckets, key_compare(a_hasher, key_equal()), a)
147 #if __TBB_INITIALIZER_LISTS_PRESENT 148 concurrent_unordered_map(std::initializer_list<value_type> il, size_type n_of_buckets = base_type::initial_bucket_number,
150 const hasher& a_hasher = hasher(),
const key_equal& a_keyeq = key_equal(),
152 : base_type(n_of_buckets, key_compare(a_hasher, a_keyeq), a)
154 insert(il.begin(),il.end());
158 : base_type(n_of_buckets, key_compare(hasher(), key_equal()), a)
160 insert(il.begin(), il.end());
164 const allocator_type& a)
165 : base_type(n_of_buckets, key_compare(a_hasher, key_equal()), a)
167 insert(il.begin(), il.end());
170 #endif //# __TBB_INITIALIZER_LISTS_PRESENT 173 #if __TBB_CPP11_RVALUE_REF_PRESENT && !__TBB_IMPLICIT_MOVE_PRESENT 178 concurrent_unordered_map& operator=(
const concurrent_unordered_map& table)
180 return static_cast<concurrent_unordered_map&
>(base_type::operator=(table));
183 concurrent_unordered_map(concurrent_unordered_map&& table)
187 concurrent_unordered_map& operator=(concurrent_unordered_map&& table)
189 return static_cast<concurrent_unordered_map&
>(base_type::operator=(
std::move(table)));
191 #endif //__TBB_CPP11_RVALUE_REF_PRESENT && !__TBB_IMPLICIT_MOVE_PRESENT 193 #if __TBB_CPP11_RVALUE_REF_PRESENT 198 #if __TBB_UNORDERED_NODE_HANDLE_PRESENT 199 template<
typename Hash,
typename Equality>
201 { this->internal_merge(source); }
203 template<
typename Hash,
typename Equality>
205 { this->internal_merge(source); }
207 template<
typename Hash,
typename Equality>
209 { this->internal_merge(source); }
211 template<
typename Hash,
typename Equality>
213 { this->internal_merge(source); }
215 #endif //__TBB_UNORDERED_NODE_HANDLE_PRESENT 218 : base_type(table, a)
224 iterator where = find(key);
228 where = insert(std::pair<key_type, mapped_type>(key, mapped_type())).first;
231 return ((*where).second);
234 mapped_type&
at(
const key_type&
key)
236 iterator where = find(key);
243 return ((*where).second);
246 const mapped_type&
at(
const key_type&
key)
const 248 const_iterator where = find(key);
255 return ((*where).second);
259 #if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT 264 template<
template<
typename...>
typename Map,
typename Key,
typename Element,
typename... Args>
265 using cu_map_t = Map<
267 std::conditional_t< (
sizeof...(Args)>0) && !is_allocator_v< pack_element_t<0, Args...> >,
269 std::conditional_t< (
sizeof...(Args)>1) && !is_allocator_v< pack_element_t<1, Args...> >,
270 pack_element_t<1, Args...>, std::equal_to<Key> >,
271 std::conditional_t< (
sizeof...(Args)>0) && is_allocator_v< pack_element_t<
sizeof...(Args)-1, Args...> >,
279 -> internal::cu_map_t<concurrent_unordered_map, internal::iterator_key_t<I>, internal::iterator_mapped_t<I>>;
282 template<
typename I,
typename... Args>
284 -> internal::cu_map_t<concurrent_unordered_map, internal::iterator_key_t<I>, internal::iterator_mapped_t<I>, Args...>;
287 template<
typename Key,
typename Element>
289 -> internal::cu_map_t<concurrent_unordered_map, Key, Element>;
292 template<
typename Key,
typename Element,
typename... Args>
298 template <
typename Key,
typename T,
typename Hasher = tbb::tbb_hash<Key>,
typename Key_equality = std::equal_to<Key>,
299 typename Allocator = tbb::tbb_allocator<std::pair<const Key, T> > >
301 public internal::concurrent_unordered_base< concurrent_unordered_map_traits< Key, T,
302 internal::hash_compare<Key, Hasher, Key_equality>, Allocator, true> >
305 typedef internal::hash_compare<Key, Hasher, Key_equality>
hash_compare;
307 typedef internal::concurrent_unordered_base<traits_type>
base_type;
308 #if __TBB_EXTRA_DEBUG 311 using traits_type::allow_multimapping;
313 using base_type::insert;
336 #if __TBB_UNORDERED_NODE_HANDLE_PRESENT 338 #endif //__TBB_UNORDERED_NODE_HANDLE_PRESENT 342 const hasher& a_hasher = hasher(),
const key_equal& a_keyeq = key_equal(),
344 : base_type(n_of_buckets, key_compare(a_hasher, a_keyeq), a)
348 : base_type(n_of_buckets, key_compare(hasher(), key_equal()), a)
352 : base_type(n_of_buckets, key_compare(a_hasher, key_equal()), a)
358 template <
typename Iterator>
360 const hasher& a_hasher = hasher(),
const key_equal& a_keyeq = key_equal(),
362 : base_type(n_of_buckets,key_compare(a_hasher,a_keyeq), a)
367 template <
typename Iterator>
369 : base_type(n_of_buckets, key_compare(hasher(), key_equal()), a)
374 template <
typename Iterator>
376 const allocator_type& a)
377 : base_type(n_of_buckets, key_compare(a_hasher, key_equal()), a)
382 #if __TBB_INITIALIZER_LISTS_PRESENT 385 const hasher& a_hasher = hasher(),
const key_equal& a_keyeq = key_equal(),
387 : base_type(n_of_buckets, key_compare(a_hasher, a_keyeq), a)
389 insert(il.begin(),il.end());
393 : base_type(n_of_buckets, key_compare(hasher(), key_equal()), a)
395 insert(il.begin(), il.end());
399 const allocator_type& a)
400 : base_type(n_of_buckets, key_compare(a_hasher, key_equal()), a)
402 insert(il.begin(), il.end());
405 #endif //# __TBB_INITIALIZER_LISTS_PRESENT 407 #if __TBB_CPP11_RVALUE_REF_PRESENT && !__TBB_IMPLICIT_MOVE_PRESENT 412 concurrent_unordered_multimap& operator=(
const concurrent_unordered_multimap& table)
414 return static_cast<concurrent_unordered_multimap&
>(base_type::operator=(table));
417 concurrent_unordered_multimap(concurrent_unordered_multimap&& table)
421 concurrent_unordered_multimap& operator=(concurrent_unordered_multimap&& table)
423 return static_cast<concurrent_unordered_multimap&
>(base_type::operator=(
std::move(table)));
425 #endif //__TBB_CPP11_RVALUE_REF_PRESENT && !__TBB_IMPLICIT_MOVE_PRESENT 427 #if __TBB_CPP11_RVALUE_REF_PRESENT 432 #if __TBB_UNORDERED_NODE_HANDLE_PRESENT 433 template<
typename Hash,
typename Equality>
435 { this->internal_merge(source); }
437 template<
typename Hash,
typename Equality>
439 { this->internal_merge(source); }
441 template<
typename Hash,
typename Equality>
443 { this->internal_merge(source); }
445 template<
typename Hash,
typename Equality>
447 { this->internal_merge(source); }
449 #endif //__TBB_UNORDERED_NODE_HANDLE_PRESENT 452 : base_type(table, a)
456 #if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT 461 -> internal::cu_map_t<concurrent_unordered_multimap, internal::iterator_key_t<I>, internal::iterator_mapped_t<I>>;
464 template<
typename I,
typename... Args>
466 -> internal::cu_map_t<concurrent_unordered_multimap, internal::iterator_key_t<I>, internal::iterator_mapped_t<I>, Args...>;
469 template<
typename Key,
typename Element>
471 -> internal::cu_map_t<concurrent_unordered_multimap, Key, Element>;
474 template<
typename Key,
typename Element,
typename... Args>
486 #endif// __TBB_concurrent_unordered_map_H void merge(concurrent_unordered_map< Key, T, Hash, Equality, Allocator > &source)
internal::concurrent_unordered_base< traits_type > base_type
concurrent_unordered_multimap(const concurrent_unordered_multimap &table, const Allocator &a)
tbb::internal::node_handle< key_type, value_type, typename internal::split_ordered_list< value_type, allocator_type >::node, allocator_type > node_type
base_type::const_iterator const_local_iterator
concurrent_unordered_map(size_type n_of_buckets, const allocator_type &a)
concurrent_unordered_multimap(std::initializer_list< value_type > il, size_type n_of_buckets, const hasher &a_hasher, const allocator_type &a)
internal::hash_compare< Key, Hasher, Key_equality > hash_compare
concurrent_unordered_map(Iterator first, Iterator last, size_type n_of_buckets, const allocator_type &a)
auto last(Container &c) -> decltype(begin(c))
base_type::reference reference
const mapped_type & at(const key_type &key) const
base_type::node_type node_type
void merge(concurrent_unordered_map< Key, T, Hash, Equality, Allocator > &source)
base_type::allocator_type allocator_type
concurrent_unordered_map_traits(const hash_compare &hc)
base_type::node_type node_type
base_type::const_reference const_reference
hash_compare my_hash_compare
concurrent_unordered_multimap(Iterator first, Iterator last, size_type n_of_buckets=base_type::initial_bucket_number, const hasher &a_hasher=hasher(), const key_equal &a_keyeq=key_equal(), const allocator_type &a=allocator_type())
concurrent_unordered_map(size_type n_of_buckets=base_type::initial_bucket_number, const hasher &a_hasher=hasher(), const key_equal &a_keyeq=key_equal(), const allocator_type &a=allocator_type())
base_type::pointer pointer
allocator_traits< Alloc >::template rebind_alloc< T >::other type
base_type::allocator_type allocator_type
tbb::internal::allocator_rebind< Allocator, value_type >::type allocator_type
auto first(Container &c) -> decltype(begin(c))
void merge(concurrent_unordered_multimap< Key, T, Hash, Equality, Allocator > &&source)
base_type::pointer pointer
concurrent_unordered_map(const Allocator &a)
base_type::const_iterator const_local_iterator
concurrent_unordered_map_traits()
mapped_type & operator[](const key_type &key)
concurrent_unordered_multimap(Iterator first, Iterator last, size_type n_of_buckets, const hasher &a_hasher, const allocator_type &a)
base_type::size_type size_type
base_type::iterator iterator
std::pair< const Key, T > value_type
concurrent_unordered_map(std::initializer_list< value_type > il, size_type n_of_buckets, const hasher &a_hasher, const allocator_type &a)
concurrent_unordered_multimap(size_type n_of_buckets=base_type::initial_bucket_number, const hasher &a_hasher=hasher(), const key_equal &a_keyeq=key_equal(), const allocator_type &a=allocator_type())
void merge(concurrent_unordered_map< Key, T, Hash, Equality, Allocator > &&source)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
base_type::value_type value_type
base_type::difference_type difference_type
internal::hash_compare< Key, Hasher, Key_equality > hash_compare
concurrent_unordered_map(size_type n_of_buckets, const hasher &a_hasher, const allocator_type &a)
concurrent_unordered_map(const concurrent_unordered_map &table, const Allocator &a)
base_type::iterator local_iterator
base_type::reference reference
concurrent_unordered_map_traits< Key, T, hash_compare, Allocator, false > traits_type
base_type::const_pointer const_pointer
base_type::value_type value_type
void move(tbb_thread &t1, tbb_thread &t2)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle * key
base_type::const_pointer const_pointer
concurrent_unordered_map(std::initializer_list< value_type > il, size_type n_of_buckets, const allocator_type &a)
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
void merge(concurrent_unordered_multimap< Key, T, Hash, Equality, Allocator > &&source)
static const Key & get_key(const std::pair< Type1, Type2 > &value)
base_type::iterator local_iterator
concurrent_unordered_multimap(size_type n_of_buckets, const allocator_type &a)
void merge(concurrent_unordered_multimap< Key, T, Hash, Equality, Allocator > &source)
concurrent_unordered_multimap(std::initializer_list< value_type > il, size_type n_of_buckets, const allocator_type &a)
concurrent_unordered_map(Iterator first, Iterator last, size_type n_of_buckets, const hasher &a_hasher, const allocator_type &a)
base_type::const_iterator const_iterator
Hash_compare hash_compare
base_type::size_type size_type
concurrent_unordered_map_traits< Key, T, hash_compare, Allocator, true > traits_type
concurrent_unordered_multimap(const Allocator &a)
Identifiers declared inside namespace internal should never be used directly by client code...
base_type::const_iterator const_iterator
concurrent_unordered_multimap(concurrent_unordered_multimap &&table, const Allocator &a)
mapped_type & at(const key_type &key)
void merge(concurrent_unordered_map< Key, T, Hash, Equality, Allocator > &&source)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp end
base_type::const_reference const_reference
concurrent_unordered_map(concurrent_unordered_map &&table, const Allocator &a)
concurrent_unordered_map(Iterator first, Iterator last, size_type n_of_buckets=base_type::initial_bucket_number, const hasher &a_hasher=hasher(), const key_equal &a_keyeq=key_equal(), const allocator_type &a=allocator_type())
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
internal::concurrent_unordered_base< traits_type > base_type
base_type::difference_type difference_type
base_type::iterator iterator
concurrent_unordered_multimap(Iterator first, Iterator last, size_type n_of_buckets, const allocator_type &a)
concurrent_unordered_multimap(size_type n_of_buckets, const hasher &a_hasher, const allocator_type &a)
void merge(concurrent_unordered_multimap< Key, T, Hash, Equality, Allocator > &source)