14#ifndef MCRL2_ATERMPP_STANDARD_CONTAINER_DETAIL_UNORDERED_MAP_IMPLEMENTATION_H
15#define MCRL2_ATERMPP_STANDARD_CONTAINER_DETAIL_UNORDERED_MAP_IMPLEMENTATION_H
24 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
32 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
36 return super::insert(value);
39 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
44 return super::insert(value);
47 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
51 return super::insert(hint, value);
54 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
59 return super::insert(hint, value);
62 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
63 template<
class InputIt >
67 super::insert(first, last);
70 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
77 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
81 return super::insert(nh);
84 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
88 return super::insert(hint, nh);
91 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
93 std::pair<typename unordered_map<Key,T,Hash,Pred,Alloc>::iterator,
bool>
unordered_map<Key,T,Hash,Pred,Alloc>::insert_or_assign(
const Key& k, M&& obj )
96 return super::insert_or_assign(k, obj);
99 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
101 std::pair<typename unordered_map<Key,T,Hash,Pred,Alloc>::iterator,
bool>
unordered_map<Key,T,Hash,Pred,Alloc>::insert_or_assign( Key&& k, M&& obj )
104 return super::insert_or_assign(k, obj);
107 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
109 typename unordered_map<Key,T,Hash,Pred,Alloc>::iterator unordered_map<Key,T,Hash,Pred,Alloc>::insert_or_assign(
const_iterator hint,
const Key& k, M&& obj )
112 return super::insert_or_assign(hint, k, obj);
115 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
117 typename unordered_map<Key,T,Hash,Pred,Alloc>::iterator unordered_map<Key,T,Hash,Pred,Alloc>::insert_or_assign(
const_iterator hint, Key&& k, M&& obj )
120 return super::insert_or_assign(hint, k, obj);
123 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
124 template<
class... Args >
128 return super::emplace(args...);
131 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
132 template <
class... Args>
136 return super::emplace_hint(hint, args...);
139 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
140 template<
class... Args >
141 std::pair<typename unordered_map<Key,T,Hash,Pred,Alloc>::iterator,
bool>
unordered_map<Key,T,Hash,Pred,Alloc>::try_emplace(
const Key& k, Args&&... args )
144 return super::try_emplace(k, args...);
147 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
148 template<
class... Args >
149 std::pair<typename unordered_map<Key,T,Hash,Pred,Alloc>::iterator,
bool>
unordered_map<Key,T,Hash,Pred,Alloc>::try_emplace( Key&& k, Args&&... args )
152 return super::try_emplace(k, args...);
155 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
156 template<
class... Args >
157 typename unordered_map<Key,T,Hash,Pred,Alloc>::iterator unordered_map<Key,T,Hash,Pred,Alloc>::try_emplace(
const_iterator hint,
const Key& k, Args&&... args )
160 return super::try_emplace(hint, k, args...);
163 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
164 template<
class... Args >
165 typename unordered_map<Key,T,Hash,Pred,Alloc>::iterator unordered_map<Key,T,Hash,Pred,Alloc>::try_emplace(
const_iterator hint, Key&& k, Args&&... args )
168 return super::try_emplace(hint, k, args...);
171 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
175 return super::erase(pos);
178 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
182 return super::erase(pos);
185 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
189 return super::erase(first, last);
192 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
196 return super::erase(key);
199 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
206 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
210 return extract(position);
213 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
220 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
221 template<
class H2,
class P2>
225 return merge(source);
228 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
229 template<
class H2,
class P2>
233 return merge(source);
236 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
237 template<
class H2,
class P2>
241 return merge(source);
244 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
245 template<
class H2,
class P2>
249 return merge(source);
252 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
256 return super::begin();
259 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
266 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
270 return super::begin();
273 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
280 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
284 return super::cbegin();
287 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
291 return super::cend();
294 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
298 return super::empty();
301 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc >
305 return super::max_size();
311 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
314 if constexpr (ThreadSafe)
317 super::rehash(new_size);
321 super::rehash(new_size);
326 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
331 std::size_t count = super::bucket_count();
332 if (super::load_factor() >= super::max_load_factor())
339 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
346 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
347 template<
typename ...Args>
348 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::find(
const Args&... args)
350 if constexpr (ThreadSafe)
353 return super::find(args...);
355 return super::find(args...);
358 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
359 template<
typename ...Args>
360 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::const_iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::find(
const Args&... args)
const
365 return super::find(args...);
367 return super::find(args...);
370 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
371 std::pair<typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator,
bool>
unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::insert(
const value_type& value)
375 return super::insert(value);
378 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
380 std::pair<typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator,
bool>
unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::insert(P&& value)
384 return super::insert(value);
387 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
388 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::insert(
const_iterator hint,
value_type&& value)
392 return super::insert(hint, value);
395 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
397 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::insert(
const_iterator hint, P&& value)
401 return super::insert(hint, value);
404 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
405 template<
class InputIt >
410 super::insert(first, last);
413 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
418 super::insert(ilist);
437 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
439 std::pair<typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator,
bool>
unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::insert_or_assign(
const Key& k, M&& obj)
443 return super::insert_or_assign(k, obj);
446 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
448 std::pair<typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator,
bool>
unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::insert_or_assign(Key&& k, M&& obj)
452 return super::insert_or_assign(k, obj);
455 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
457 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::insert_or_assign(
const_iterator hint,
const Key& k, M&& obj)
461 return super::insert_or_assign(hint, k, obj);
464 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
466 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::insert_or_assign(
const_iterator hint, Key&& k, M&& obj)
470 return super::insert_or_assign(hint, k, obj);
473 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
474 template<
class... Args >
475 std::pair<typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator,
bool>
unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::emplace(Args&&... args)
479 return super::emplace(args...);
482 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
483 template <
class... Args>
484 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::emplace_hint(
const_iterator hint, Args&&... args)
488 return super::emplace(hint, args...);
491 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
492 template<
class... Args >
493 std::pair<typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator,
bool>
unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::try_emplace(
const Key& k, Args&&... args)
497 return super::try_emplace(k, args...);
500 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
501 template<
class... Args >
502 std::pair<typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator,
bool>
unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::try_emplace(Key&& k, Args&&... args)
506 return super::try_emplace(k, args...);
509 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
510 template<
class... Args >
511 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::try_emplace(
const_iterator hint,
const Key& k, Args&&... args)
515 return super::try_emplace(hint, k, args...);
518 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
519 template<
class... Args >
520 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::try_emplace(
const_iterator hint, Key&& k, Args&&... args)
524 return super::try_emplace(hint, k, args...);
527 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
528 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::erase(
iterator pos)
531 return super::erase(pos);
534 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
535 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::erase(
const_iterator pos)
538 return super::erase(pos);
541 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
542 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::erase(
const_iterator first,
const_iterator last)
545 return super::erase(first, last);
548 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
549 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::size_type unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::erase(
const Key& key)
552 return super::erase(key);
555 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
562 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
563 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::begin()
566 return super::begin();
569 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
570 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::end()
576 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
577 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::const_iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::begin()
const
580 return super::begin();
583 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
584 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::const_iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::end()
const
590 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
591 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::const_iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::cbegin()
const
594 return super::cbegin();
597 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
598 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::const_iterator unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::cend()
const
601 return super::cend();
604 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
608 return super::empty();
611 template<
class Key,
class T,
class Hash,
class Pred,
class Alloc,
bool ThreadSafe >
612 typename unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::size_type unordered_map<Key,T,Hash,Pred,Alloc,ThreadSafe>::max_size() const noexcept
615 return super::max_size();
mcrl2::utilities::lock_guard lock()
Acquire an exclusive lock.
mcrl2::utilities::shared_guard lock_shared()
Acquire a shared lock on this thread aterm pool.
A unordered_map class in which aterms can be stored.
std::pair< iterator, bool > try_emplace(const Key &k, Args &&... args)
std::pair< iterator, bool > insert(const value_type &value)
Inserts an element referring to a default value in the map.
super::node_type node_type
iterator emplace_hint(const_iterator hint, Args &&... args)
super::size_type size_type
super::insert_return_type insert_return_type
node_type extract(const_iterator position)
const_iterator cend() const
const_iterator cbegin() const
void merge(std::unordered_map< Key, T, H2, P2, allocator_type > &source)
super::value_type value_type
std::pair< iterator, bool > emplace(Args &&... args)
iterator erase(iterator pos)
std::pair< iterator, bool > insert_or_assign(const Key &k, M &&obj)
size_type max_size() const noexcept
bool empty() const noexcept
void swap(unordered_map &other)
super::const_iterator const_iterator
A unordered_map class in which aterms can be stored.
std::pair< iterator, bool > try_emplace(const Key &k, Args &&... args)
iterator find(const Args &... args)
Standard find function in a map.
super::size_type size_type
const_iterator cbegin() const
size_type max_size() const noexcept
std::pair< iterator, bool > insert_or_assign(const Key &k, M &&obj)
const_iterator cend() const
iterator erase(iterator pos)
super::value_type value_type
iterator emplace_hint(const_iterator hint, Args &&... args)
bool empty() const noexcept
void swap(unordered_map &other)
std::pair< iterator, bool > insert(const value_type &value)
std::pair< iterator, bool > emplace(Args &&... args)
void rehash(std::size_t)
Function below is implemented in a .cpp file.
super::const_iterator const_iterator
An exclusive lock guard for the shared_mutex.
A shared lock guard for the shared_mutex.
void unlock_shared()
Unlocks the acquired shared guard explicitly. Otherwise, performed in destructor.
thread_aterm_pool & g_thread_term_pool()
A reference to the thread local term pool storage.
The main namespace for the aterm++ library.