Go to the documentation of this file.
24 #ifndef TSL_ROBIN_MAP_H
25 #define TSL_ROBIN_MAP_H
29 #include <initializer_list>
31 #include <type_traits>
86 template <
class Key,
class T,
class Hash = std::hash<Key>,
87 class KeyEqual = std::equal_to<Key>,
88 class Allocator = std::allocator<std::pair<Key, T>>,
89 bool StoreHash = false,
90 class GrowthPolicy = tsl::rh::power_of_two_growth_policy<2>>
101 const std::pair<Key, T>& key_value)
const noexcept {
102 return key_value.first;
106 return key_value.first;
115 const std::pair<Key, T>& key_value)
const noexcept {
116 return key_value.second;
120 return key_value.second;
125 ValueSelect, Hash, KeyEqual,
126 Allocator, StoreHash, GrowthPolicy>;
151 const KeyEqual& equal = KeyEqual(),
152 const Allocator& alloc = Allocator())
162 :
robin_map(
ht::DEFAULT_INIT_BUCKETS_SIZE, alloc) {}
164 template <
class InputIt>
167 const Hash& hash = Hash(),
const KeyEqual& equal = KeyEqual(),
168 const Allocator& alloc = Allocator())
173 template <
class InputIt>
175 const Allocator& alloc)
178 template <
class InputIt>
180 const Hash& hash,
const Allocator& alloc)
185 const Hash& hash = Hash(),
const KeyEqual& equal = KeyEqual(),
186 const Allocator& alloc = Allocator())
190 const Allocator& alloc)
195 const Hash& hash,
const Allocator& alloc)
237 template <
class P,
typename std::enable_if<std::is_constructible<
251 template <
class P,
typename std::enable_if<std::is_constructible<
261 template <
class InputIt>
262 void insert(InputIt first, InputIt last) {
266 void insert(std::initializer_list<value_type> ilist) {
297 template <
class... Args>
298 std::pair<iterator, bool>
emplace(Args&&... args) {
309 template <
class... Args>
314 template <
class... Args>
319 template <
class... Args>
324 template <
class... Args>
329 template <
class... Args>
332 std::forward<Args>(args)...);
356 return m_ht.
erase(key, precalculated_hash);
365 class K,
class KE = KeyEqual,
366 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
379 class K,
class KE = KeyEqual,
380 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
382 return m_ht.
erase(key, precalculated_hash);
397 T&
at(
const Key& key, std::size_t precalculated_hash) {
398 return m_ht.
at(key, precalculated_hash);
406 const T&
at(
const Key& key, std::size_t precalculated_hash)
const {
407 return m_ht.
at(key, precalculated_hash);
416 class K,
class KE = KeyEqual,
417 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
418 T&
at(
const K& key) {
430 class K,
class KE = KeyEqual,
431 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
432 T&
at(
const K& key, std::size_t precalculated_hash) {
433 return m_ht.
at(key, precalculated_hash);
440 class K,
class KE = KeyEqual,
441 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
442 const T&
at(
const K& key)
const {
450 class K,
class KE = KeyEqual,
451 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
452 const T&
at(
const K& key, std::size_t precalculated_hash)
const {
453 return m_ht.
at(key, precalculated_hash);
467 return m_ht.
count(key, precalculated_hash);
476 class K,
class KE = KeyEqual,
477 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
490 class K,
class KE = KeyEqual,
491 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
493 return m_ht.
count(key, precalculated_hash);
504 return m_ht.
find(key, precalculated_hash);
513 return m_ht.
find(key, precalculated_hash);
522 class K,
class KE = KeyEqual,
523 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
536 class K,
class KE = KeyEqual,
537 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
539 return m_ht.
find(key, precalculated_hash);
546 class K,
class KE = KeyEqual,
547 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
560 class K,
class KE = KeyEqual,
561 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
563 return m_ht.
find(key, precalculated_hash);
573 bool contains(
const Key& key, std::size_t precalculated_hash)
const {
583 class K,
class KE = KeyEqual,
584 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
597 class K,
class KE = KeyEqual,
598 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
599 bool contains(
const K& key, std::size_t precalculated_hash)
const {
613 std::size_t precalculated_hash) {
625 const Key& key, std::size_t precalculated_hash)
const {
635 class K,
class KE = KeyEqual,
636 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
649 class K,
class KE = KeyEqual,
650 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
652 std::size_t precalculated_hash) {
660 class K,
class KE = KeyEqual,
661 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
662 std::pair<const_iterator, const_iterator>
equal_range(
const K& key)
const {
670 class K,
class KE = KeyEqual,
671 typename std::enable_if<has_is_transparent<KE>::value>::type* =
nullptr>
673 const K& key, std::size_t precalculated_hash)
const {
736 template <
class Serializer>
767 template <
class Deserializer>
769 bool hash_compatible =
false) {
781 for (
const auto& element_lhs : lhs) {
782 const auto it_element_rhs = rhs.
find(element_lhs.first);
783 if (it_element_rhs == rhs.
cend() ||
784 element_lhs.second != it_element_rhs->second) {
806 template <
class Key,
class T,
class Hash = std::hash<Key>,
807 class KeyEqual = std::equal_to<Key>,
808 class Allocator = std::allocator<std::pair<Key, T>>,
809 bool StoreHash = false>
iterator mutable_iterator(const_iterator pos)
float min_load_factor() const
bool contains(const Key &key, std::size_t precalculated_hash) const
typename ht::const_reference const_reference
std::pair< iterator, bool > emplace(Args &&... args)
void serialize(Serializer &serializer) const
iterator find(const K &key, std::size_t precalculated_hash)
void erase_fast(iterator pos)
bool contains(const K &key) const
const value_type * const_pointer
void reserve(size_type count_)
const T & at(const K &key, std::size_t precalculated_hash) const
std::pair< const_iterator, const_iterator > equal_range(const Key &key) const
hasher hash_function() const
size_type size() const noexcept
float max_load_factor() const
std::pair< iterator, bool > insert(P &&value)
robin_map(size_type bucket_count, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator())
T & operator[](const Key &key)
size_type max_bucket_count() const
iterator find(const Key &key, std::size_t precalculated_hash)
typename ht::key_equal key_equal
std::pair< iterator, bool > emplace(Args &&... args)
const T & at(const K &key) const
hasher hash_function() const
iterator erase(const_iterator first, const_iterator last)
std::ptrdiff_t difference_type
std::pair< iterator, iterator > equal_range(const Key &key, std::size_t precalculated_hash)
iterator begin() noexcept
void swap(robin_map &other)
value_type & operator()(std::pair< Key, T > &key_value) noexcept
const_iterator end() const noexcept
bool empty() const noexcept
PointMatcherSupport::Parametrizable P
bool contains(const Key &key) const
iterator insert(const_iterator hint, value_type &&value)
size_type erase(const K &key, std::size_t precalculated_hash)
void serialize(Serializer &serializer) const
friend bool operator!=(const robin_map &lhs, const robin_map &rhs)
size_type count(const K &key) const
const_iterator find(const Key &key) const
void insert(InputIt first, InputIt last)
std::pair< iterator, bool > insert(const value_type &value)
const_iterator find(const K &key, std::size_t precalculated_hash) const
typename ht::key_type key_type
const_iterator begin() const noexcept
void max_load_factor(float ml)
bool contains(const K &key) const
T & operator[](Key &&key)
bool contains(const K &key, std::size_t precalculated_hash) const
const T & at(const Key &key, std::size_t precalculated_hash) const
typename ht::hasher hasher
std::pair< iterator, bool > insert_or_assign(const key_type &k, M &&obj)
U::value_type & at(const K &key)
size_type max_size() const noexcept
size_type bucket_count() const
bool empty() const noexcept
iterator insert_hint(const_iterator hint, P &&value)
robin_map & operator=(std::initializer_list< value_type > ilist)
std::pair< iterator, iterator > equal_range(const Key &key)
typename ht::allocator_type allocator_type
typename ht::const_pointer const_pointer
size_type max_size() const noexcept
robin_map(size_type bucket_count, const Allocator &alloc)
iterator try_emplace(const_iterator hint, const key_type &k, Args &&... args)
size_type erase(const K &key)
iterator find(const K &key)
typename ht::value_type value_type
size_type count(const K &key, std::size_t precalculated_hash) const
std::pair< iterator, bool > try_emplace(const key_type &k, Args &&... args)
iterator insert_or_assign(const_iterator hint, const key_type &k, M &&obj)
const_iterator cbegin() const noexcept
void rehash(size_type count_)
void min_load_factor(float ml)
robin_map(std::initializer_list< value_type > init, size_type bucket_count, const Allocator &alloc)
size_type count(const K &key) const
const T & at(const Key &key) const
std::pair< const_iterator, const_iterator > equal_range(const Key &key, std::size_t precalculated_hash) const
static const size_type DEFAULT_INIT_BUCKETS_SIZE
const_iterator cend() const noexcept
std::pair< iterator, bool > try_emplace(key_type &&k, Args &&... args)
T & at(const Key &key, std::size_t precalculated_hash)
iterator insert(const_iterator hint, P &&value)
iterator erase(iterator pos)
iterator find(const Key &key)
std::pair< iterator, iterator > equal_range(const K &key, std::size_t precalculated_hash)
float load_factor() const
iterator mutable_iterator(const_iterator pos)
iterator erase(const_iterator pos)
std::pair< const_iterator, const_iterator > equal_range(const K &key) const
robin_map(InputIt first, InputIt last, size_type bucket_count, const Hash &hash, const Allocator &alloc)
const_iterator find(const K &key) const
iterator find(const K &key)
std::pair< iterator, bool > insert_or_assign(key_type &&k, M &&obj)
const_iterator find(const Key &key, std::size_t precalculated_hash) const
iterator emplace_hint(const_iterator hint, Args &&... args)
robin_map(InputIt first, InputIt last, size_type bucket_count=ht::DEFAULT_INIT_BUCKETS_SIZE, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator())
typename ht::pointer pointer
std::pair< iterator, bool > insert_or_assign(K &&key, M &&obj)
allocator_type get_allocator() const
robin_iterator< true > const_iterator
robin_map(std::initializer_list< value_type > init, size_type bucket_count=ht::DEFAULT_INIT_BUCKETS_SIZE, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator())
void swap(robin_hash &other)
typename ht::iterator iterator
friend bool operator==(const robin_map &lhs, const robin_map &rhs)
float min_load_factor() const
iterator emplace_hint(const_iterator hint, Args &&... args)
size_type count(const Key &key, std::size_t precalculated_hash) const
const value_type & operator()(const std::pair< Key, T > &key_value) const noexcept
std::pair< iterator, iterator > equal_range(const K &key)
const_iterator cbegin() const noexcept
robin_map(std::initializer_list< value_type > init, size_type bucket_count, const Hash &hash, const Allocator &alloc)
iterator try_emplace_hint(const_iterator hint, K &&key, Args &&... args)
robin_map(const Allocator &alloc)
The superclass of classes that are constructed using generic parameters. This class provides the para...
detail_robin_hash::robin_hash< std::pair< Key, T >, KeySelect, ValueSelect, Hash, KeyEqual, Allocator, StoreHash, GrowthPolicy > ht
typename ht::reference reference
void erase_fast(iterator pos)
robin_map(InputIt first, InputIt last, size_type bucket_count, const Allocator &alloc)
size_type count(const Key &key) const
iterator insert(const_iterator hint, const value_type &value)
friend void swap(robin_map &lhs, robin_map &rhs)
typename ht::size_type size_type
typename ht::difference_type difference_type
T & at(const K &key, std::size_t precalculated_hash)
static robin_map deserialize(Deserializer &deserializer, bool hash_compatible=false)
allocator_type get_allocator() const
void init(const M_string &remappings)
size_type erase(const key_type &key)
void insert(std::initializer_list< value_type > ilist)
std::pair< const_iterator, const_iterator > equal_range(const K &key, std::size_t precalculated_hash) const
std::pair< iterator, bool > insert(value_type &&value)
size_type max_bucket_count() const
robin_map(size_type bucket_count, const Hash &hash, const Allocator &alloc)
std::pair< iterator, iterator > equal_range(const K &key)
const key_type & operator()(const std::pair< Key, T > &key_value) const noexcept
typename KeySelect::key_type key_type
size_type erase(const key_type &key, std::size_t precalculated_hash)
size_type size() const noexcept
key_type & operator()(std::pair< Key, T > &key_value) noexcept
iterator try_emplace(const_iterator hint, key_type &&k, Args &&... args)
void reserve(size_type count_)
size_type bucket_count() const
iterator erase(iterator pos)
iterator insert_or_assign(const_iterator hint, key_type &&k, M &&obj)
std::pair< iterator, bool > try_emplace(K &&key, Args &&... args)
typename ht::const_iterator const_iterator
void rehash(size_type count_)
iterator begin() noexcept
robin_iterator< false > iterator
float max_load_factor() const
std::pair< iterator, bool > insert(P &&value)
const_iterator cend() const noexcept
float load_factor() const
const value_type & const_reference
void deserialize(Deserializer &deserializer, bool hash_compatible)
mp2p_icp
Author(s): Jose-Luis Blanco-Claraco
autogenerated on Fri Jul 5 2024 02:47:03