24 #ifndef TSL_ROBIN_HASH_H 25 #define TSL_ROBIN_HASH_H 39 #include <type_traits> 45 namespace detail_robin_hash {
66 template <std::
size_t GrowthFactor>
73 template <
class T>
const T &
clamp(
const T &v,
const T &lo,
const T &hi)
75 return std::min(hi, std::max(lo, v));
128 template <
typename ValueType,
bool StoreHash>
152 std::is_nothrow_copy_constructible<value_type>::value)
156 if (!other.empty()) {
168 std::is_nothrow_move_constructible<value_type>::value)
173 if (!other.empty()) {
174 ::new (static_cast<void *>(std::addressof(
m_value)))
value_type(std::move(other.value()));
180 std::is_nothrow_copy_constructible<value_type>::value)
182 if (
this != &other) {
185 bucket_hash::operator=(other);
186 if (!other.empty()) {
217 return *reinterpret_cast<value_type *>(std::addressof(
m_value));
223 return *reinterpret_cast<const value_type *>(std::addressof(
m_value));
232 template <
typename... Args>
239 ::new (static_cast<void *>(std::addressof(
m_value)))
240 value_type(std::forward<Args>(value_type_args)...);
253 swap(my_value, this->
value());
274 value().~value_type();
306 template <
class ValueType,
class KeySelect,
class ValueSelect,
class Hash,
class KeyEqual,
307 class Allocator,
bool StoreHash,
class GrowthPolicy>
308 class robin_hash :
private Hash,
private KeyEqual,
private GrowthPolicy
311 template <
typename U>
312 using has_mapped_type =
typename std::integral_constant<bool, !std::is_same<U, void>::value>;
314 static_assert(noexcept(std::declval<GrowthPolicy>().
bucket_for_hash(std::size_t(0))),
315 "GrowthPolicy::bucket_for_hash must be noexcept.");
316 static_assert(noexcept(std::declval<GrowthPolicy>().
clear()),
317 "GrowthPolicy::clear must be noexcept.");
348 (!std::is_arithmetic<key_type>::value ||
349 !std::is_same<Hash, std::hash<key_type>>::value));
371 return (
bucket_count - 1) <= std::numeric_limits<truncated_hash_type>::max();
382 typename std::allocator_traits<allocator_type>::template rebind_alloc<bucket_entry>;
397 template <
bool IsConst>
class robin_iterator
403 typename std::conditional<IsConst, const bucket_entry *, bucket_entry *>::type;
417 template <bool TIsConst = IsConst, typename std::enable_if<TIsConst>::type * =
nullptr>
429 template <
class U = ValueSelect,
430 typename std::enable_if<has_mapped_type<U>::value && IsConst>::type * =
nullptr>
431 const typename U::value_type &
value()
const 436 template <
class U = ValueSelect,
437 typename std::enable_if<has_mapped_type<U>::value && !IsConst>::type * =
nullptr>
472 return lhs.m_bucket == rhs.m_bucket;
477 return !(lhs == rhs);
485 #if defined(__cplusplus) && __cplusplus >= 201402L 489 : Hash(hash), KeyEqual(equal), GrowthPolicy(
bucket_count),
493 "The map exceeds its maxmimum bucket count.")
521 : Hash(hash), KeyEqual(equal), GrowthPolicy(my_bucket_count),
m_buckets_data(alloc),
527 "The map exceeds its maxmimum bucket count.");
555 std::is_nothrow_move_constructible<Hash>::value &&std::is_nothrow_move_constructible<
556 KeyEqual>::value &&std::is_nothrow_move_constructible<GrowthPolicy>::value
557 && std::is_nothrow_move_constructible<buckets_container_type>::value)
558 : Hash(std::move(static_cast<Hash &>(other))),
559 KeyEqual(std::move(static_cast<KeyEqual &>(other))),
560 GrowthPolicy(std::move(static_cast<GrowthPolicy &>(other))),
569 other.GrowthPolicy::clear();
570 other.m_buckets_data.clear();
572 other.m_bucket_count = 0;
573 other.m_nb_elements = 0;
574 other.m_load_threshold = 0;
575 other.m_grow_on_next_insert =
false;
576 other.m_try_skrink_on_next_insert =
false;
581 if (&other !=
this) {
582 Hash:: operator=(other);
583 KeyEqual:: operator=(other);
584 GrowthPolicy::operator=(other);
665 template <
typename P> std::pair<iterator, bool>
insert(P &&value)
667 return insert_impl(KeySelect()(value), std::forward<P>(value));
672 if (hint !=
cend() &&
compare_keys(KeySelect()(*hint), KeySelect()(value))) {
676 return insert(std::forward<P>(value)).first;
679 template <
class InputIt>
void insert(InputIt first, InputIt last)
681 if (std::is_base_of<std::forward_iterator_tag,
682 typename std::iterator_traits<InputIt>::iterator_category>::value) {
683 const auto nb_elements_insert = std::distance(first, last);
687 if (nb_elements_insert > 0 && nb_free_buckets <
size_type(nb_elements_insert)) {
692 for (; first != last; ++first) {
699 auto it =
try_emplace(std::forward<K>(key), std::forward<M>(obj));
701 it.first.value() = std::forward<M>(obj);
711 it.value() = std::forward<M>(obj);
719 template <
class... Args> std::pair<iterator, bool>
emplace(Args &&... args)
729 template <
class K,
class... Args>
733 std::forward_as_tuple(std::forward<K>(key)),
734 std::forward_as_tuple(std::forward<Args>(args)...));
737 template <
class K,
class... Args>
744 return try_emplace(std::forward<K>(key), std::forward<Args>(args)...).first;
759 if (pos.m_bucket->empty()) {
778 for (
auto it = first_mutable.m_bucket; it != last_mutable.m_bucket; ++it) {
785 if (last_mutable ==
end()) {
793 std::size_t icloser_bucket = static_cast<std::size_t>(first_mutable.m_bucket -
m_buckets);
794 std::size_t ito_move_closer_value =
795 static_cast<std::size_t>(last_mutable.m_bucket -
m_buckets);
798 const std::size_t ireturn_bucket =
799 ito_move_closer_value -
800 std::min(ito_move_closer_value - icloser_bucket,
801 std::size_t(
m_buckets[ito_move_closer_value].dist_from_ideal_bucket()));
804 m_buckets[ito_move_closer_value].dist_from_ideal_bucket() > 0) {
806 ito_move_closer_value -
807 std::min(ito_move_closer_value - icloser_bucket,
808 std::size_t(
m_buckets[ito_move_closer_value].dist_from_ideal_bucket()));
813 (ito_move_closer_value - icloser_bucket));
815 new_distance,
m_buckets[ito_move_closer_value].truncated_hash(),
816 std::move(
m_buckets[ito_move_closer_value].value()));
820 ++ito_move_closer_value;
832 auto it =
find(key, hash);
848 swap(static_cast<Hash &>(*
this), static_cast<Hash &>(other));
849 swap(static_cast<KeyEqual &>(*
this), static_cast<KeyEqual &>(other));
850 swap(static_cast<GrowthPolicy &>(*
this), static_cast<GrowthPolicy &>(other));
865 template <
class K,
class U = ValueSelect,
866 typename std::enable_if<has_mapped_type<U>::value>::type * =
nullptr>
867 typename U::value_type &
at(
const K &key)
872 template <
class K,
class U = ValueSelect,
873 typename std::enable_if<has_mapped_type<U>::value>::type * =
nullptr>
874 typename U::value_type &
at(
const K &key, std::size_t hash)
876 return const_cast<typename U::value_type &>(
877 static_cast<const robin_hash *>(
this)->
at(key, hash));
880 template <
class K,
class U = ValueSelect,
881 typename std::enable_if<has_mapped_type<U>::value>::type * =
nullptr>
882 const typename U::value_type &
at(
const K &key)
const 887 template <
class K,
class U = ValueSelect,
888 typename std::enable_if<has_mapped_type<U>::value>::type * =
nullptr>
889 const typename U::value_type &
at(
const K &key, std::size_t hash)
const 891 auto it =
find(key, hash);
900 template <
class K,
class U = ValueSelect,
901 typename std::enable_if<has_mapped_type<U>::value>::type * =
nullptr>
904 return try_emplace(std::forward<K>(key)).first.value();
936 template <
class K> std::pair<iterator, iterator>
equal_range(
const K &key)
941 template <
class K> std::pair<iterator, iterator>
equal_range(
const K &key, std::size_t hash)
944 return std::make_pair(it, (it ==
end()) ? it : std::next(it));
947 template <
class K> std::pair<const_iterator, const_iterator>
equal_range(
const K &key)
const 953 std::pair<const_iterator, const_iterator>
equal_range(
const K &key, std::size_t hash)
const 956 return std::make_pair(it, (it ==
cend()) ? it : std::next(it));
966 return std::min(GrowthPolicy::max_bucket_count(),
m_buckets_data.max_size());
1021 return iterator(const_cast<bucket_entry *>(pos.m_bucket));
1025 template <
class K> std::size_t
hash_key(
const K &key)
const {
return Hash::operator()(key); }
1027 template <
class K1,
class K2>
bool compare_keys(
const K1 &key1,
const K2 &key2)
const 1029 return KeyEqual::operator()(key1, key2);
1034 const std::size_t bucket = GrowthPolicy::bucket_for_hash(hash);
1040 template <
class U = GrowthPolicy,
1041 typename std::enable_if<is_power_of_two_policy<U>::value>::type * =
nullptr>
1046 return (index + 1) & this->m_mask;
1049 template <
class U = GrowthPolicy,
1050 typename std::enable_if<!is_power_of_two_policy<U>::value>::type * =
nullptr>
1069 while (dist_from_ideal_bucket <=
m_buckets[ibucket].dist_from_ideal_bucket()) {
1077 dist_from_ideal_bucket++;
1085 pos.m_bucket->clear();
1095 std::size_t previous_ibucket = static_cast<std::size_t>(pos.m_bucket -
m_buckets);
1096 std::size_t ibucket =
next_bucket(previous_ibucket);
1098 while (
m_buckets[ibucket].dist_from_ideal_bucket() > 0) {
1104 new_distance,
m_buckets[ibucket].truncated_hash(),
1108 previous_ibucket = ibucket;
1113 template <
class K,
class... Args>
1114 std::pair<iterator, bool>
insert_impl(
const K &key, Args &&... value_type_args)
1116 const std::size_t hash =
hash_key(key);
1121 while (dist_from_ideal_bucket <=
m_buckets[ibucket].dist_from_ideal_bucket()) {
1128 dist_from_ideal_bucket++;
1133 dist_from_ideal_bucket = 0;
1135 while (dist_from_ideal_bucket <=
m_buckets[ibucket].dist_from_ideal_bucket()) {
1137 dist_from_ideal_bucket++;
1144 std::forward<Args>(value_type_args)...);
1148 std::forward<Args>(value_type_args)...);
1159 template <
class... Args>
1163 value_type value(std::forward<Args>(value_type_args)...);
1185 dist_from_ideal_bucket++;
1188 if (dist_from_ideal_bucket >
m_buckets[ibucket].dist_from_ideal_bucket()) {
1202 dist_from_ideal_bucket++;
1211 robin_hash new_table(my_count, static_cast<Hash &>(*
this), static_cast<KeyEqual &>(*
this),
1216 if (bucket.empty()) {
1220 const std::size_t hash = use_stored_hash
1221 ? bucket.truncated_hash()
1222 : new_table.
hash_key(KeySelect()(bucket.value()));
1226 std::move(bucket.value()));
1230 new_table.
swap(*
this);
1237 if (dist_from_ideal_bucket >
m_buckets[ibucket].dist_from_ideal_bucket()) {
1248 dist_from_ideal_bucket++;
1293 "MINIMUM_MAX_LOAD_FACTOR should be < MAXIMUM_MAX_LOAD_FACTOR");
1295 "MINIMUM_MIN_LOAD_FACTOR should be < MAXIMUM_MIN_LOAD_FACTOR");
1297 "MAXIMUM_MIN_LOAD_FACTOR should be < MINIMUM_MAX_LOAD_FACTOR");
1309 return &empty_bucket;
std::pair< iterator, iterator > equal_range(const K &key)
Definition: robin_hash.h:936
value_type & reference
Definition: robin_hash.h:329
iterator end() noexcept
Definition: robin_hash.h:637
std::int_least16_t distance_type
Definition: robin_hash.h:135
size_type m_nb_elements
Definition: robin_hash.h:1330
truncated_hash_type m_hash
Definition: robin_hash.h:108
std::size_t size_type
Definition: robin_hash.h:324
robin_hash & operator=(robin_hash &&other)
Definition: robin_hash.h:602
friend bool operator!=(const robin_iterator &lhs, const robin_iterator &rhs)
Definition: robin_hash.h:475
std::vector< bucket_entry, buckets_allocator > buckets_container_type
Definition: robin_hash.h:383
friend bool operator==(const robin_iterator &lhs, const robin_iterator &rhs)
Definition: robin_hash.h:470
size_type bucket_count() const
Definition: robin_hash.h:962
float m_min_load_factor
Definition: robin_hash.h:1337
size_type m_bucket_count
Definition: robin_hash.h:1328
bucket_entry & operator=(const bucket_entry &other) noexcept(std::is_nothrow_copy_constructible< value_type >::value)
Definition: robin_hash.h:179
size_type max_bucket_count() const
Definition: robin_hash.h:964
iterator find_impl(const K &key, std::size_t hash)
Definition: robin_hash.h:1059
std::pair< iterator, bool > try_emplace(K &&key, Args &&... args)
Definition: robin_hash.h:730
static const distance_type REHASH_ON_HIGH_NB_PROBES__NPROBES
Definition: robin_hash.h:1300
const_iterator find(const K &key) const
Definition: robin_hash.h:926
bool bucket_hash_equal(std::size_t hash) const noexcept
Definition: robin_hash.h:97
#define TSL_RH_LIKELY(exp)
Definition: robin_growth_policy.h:67
bucket_entry(bool my_last_bucket) noexcept
Definition: robin_hash.h:144
const value_type & value() const noexcept
Definition: robin_hash.h:220
void erase_from_bucket(iterator pos)
Definition: robin_hash.h:1083
const value_type & const_reference
Definition: robin_hash.h:330
bool rehash_on_extreme_load()
Definition: robin_hash.h:1260
static const distance_type EMPTY_MARKER_DIST_FROM_IDEAL_BUCKET
Definition: robin_hash.h:280
Definition: robin_hash.h:320
std::pair< iterator, bool > insert(P &&value)
Definition: robin_hash.h:665
float load_factor() const
Definition: robin_hash.h:972
typename KeySelect::key_type key_type
Definition: robin_hash.h:322
iterator find(const K &key, std::size_t hash)
Definition: robin_hash.h:921
Definition: hopscotch_growth_policy.h:37
const robin_hash::key_type & key() const
Definition: robin_hash.h:427
const_iterator find_impl(const K &key, std::size_t hash) const
Definition: robin_hash.h:1064
U::value_type & value()
Definition: robin_hash.h:438
std::size_t hash_key(const K &key) const
Definition: robin_hash.h:1025
value_type & value() noexcept
Definition: robin_hash.h:214
std::pair< Key, T > value_type
Definition: robin_hash.h:323
const T & clamp(const T &v, const T &lo, const T &hi)
Definition: robin_hash.h:73
iterator insert_hint(const_iterator hint, P &&value)
Definition: robin_hash.h:670
size_type m_load_threshold
Definition: robin_hash.h:1332
iterator begin() noexcept
Definition: robin_hash.h:615
iterator erase(const_iterator pos)
Definition: robin_hash.h:768
const U::value_type & at(const K &key) const
Definition: robin_hash.h:882
size_type count(const K &key) const
Definition: robin_hash.h:907
typename std::integral_constant< bool, !std::is_same< U, void >::value > has_mapped_type
Definition: robin_hash.h:312
void clear() noexcept
Definition: robin_hash.h:655
void insert(InputIt first, InputIt last)
Definition: robin_hash.h:679
static constexpr float DEFAULT_MIN_LOAD_FACTOR
Definition: robin_hash.h:1288
robin_iterator(bucket_entry_ptr bucket) noexcept
Definition: robin_hash.h:405
void insert_value_on_rehash(std::size_t ibucket, distance_type dist_from_ideal_bucket, truncated_hash_type hash, value_type &&value)
Definition: robin_hash.h:1233
const value_type * const_pointer
Definition: robin_hash.h:332
robin_hash(size_type my_bucket_count, const Hash &hash, const KeyEqual &equal, const Allocator &alloc, float my_min_load_factor=DEFAULT_MIN_LOAD_FACTOR, float my_max_load_factor=DEFAULT_MAX_LOAD_FACTOR)
Definition: robin_hash.h:518
pointer operator->() const
Definition: robin_hash.h:445
std::pair< const_iterator, const_iterator > equal_range(const K &key) const
Definition: robin_hash.h:947
const U::value_type & at(const K &key, std::size_t hash) const
Definition: robin_hash.h:889
void destroy_value() noexcept
Definition: robin_hash.h:271
robin_iterator operator++(int)
Definition: robin_hash.h:462
iterator erase(iterator pos)
Definition: robin_hash.h:751
std::size_t bucket_for_hash(std::size_t hash) const
Definition: robin_hash.h:1032
const_iterator cbegin() const noexcept
Definition: robin_hash.h:627
size_type size() const noexcept
Definition: robin_hash.h:648
bool empty() const noexcept
Definition: robin_hash.h:209
std::forward_iterator_tag iterator_category
Definition: robin_hash.h:408
std::uint_least32_t truncated_hash_type
Definition: robin_hash.h:78
std::size_t next_bucket(std::size_t index) const noexcept
Definition: robin_hash.h:1042
robin_hash(const robin_hash &other)
Definition: robin_hash.h:543
const_iterator cend() const noexcept
Definition: robin_hash.h:641
KeyEqual key_equal
Definition: robin_hash.h:327
bucket_entry * m_buckets
Definition: robin_hash.h:1323
bucket_entry_ptr m_bucket
Definition: robin_hash.h:481
void set_hash(truncated_hash_type hash) noexcept
Definition: robin_hash.h:105
void set_as_last_bucket() noexcept
Definition: robin_hash.h:230
std::pair< iterator, bool > insert_or_assign(K &&key, M &&obj)
Definition: robin_hash.h:697
static constexpr bool STORE_HASH
Definition: robin_hash.h:342
bucket_entry(bucket_entry &&other) noexcept(std::is_nothrow_move_constructible< value_type >::value)
Definition: robin_hash.h:167
bucket_entry_hash< StoreHash > bucket_hash
Definition: robin_hash.h:131
iterator mutable_iterator(const_iterator pos)
Definition: robin_hash.h:1019
void set_value_of_empty_bucket(distance_type my_dist_from_ideal_bucket, truncated_hash_type hash, Args &&... value_type_args)
Definition: robin_hash.h:233
void min_load_factor(float ml)
Definition: robin_hash.h:985
size_type count(const K &key, std::size_t hash) const
Definition: robin_hash.h:909
iterator emplace_hint(const_iterator hint, Args &&... args)
Definition: robin_hash.h:724
bool compare_keys(const K1 &key1, const K2 &key2) const
Definition: robin_hash.h:1027
static bool USE_STORED_HASH_ON_REHASH(size_type bucket_count)
Definition: robin_hash.h:363
ValueType value_type
Definition: robin_hash.h:134
const typename robin_hash::value_type value_type
Definition: robin_hash.h:409
void rehash_impl(size_type my_count)
Definition: robin_hash.h:1209
size_type max_size() const noexcept
Definition: robin_hash.h:650
Definition: robin_hash.h:62
bool m_grow_on_next_insert
Definition: robin_hash.h:1335
bucket_entry * static_empty_bucket_ptr()
Definition: robin_hash.h:1306
robin_iterator< true > const_iterator
Definition: robin_hash.h:334
void swap(robin_hash &other)
Definition: robin_hash.h:844
typename std::conditional< IsConst, const bucket_entry *, bucket_entry * >::type bucket_entry_ptr
Definition: robin_hash.h:403
const U::value_type & value() const
Definition: robin_hash.h:431
distance_type dist_from_ideal_bucket() const noexcept
Definition: robin_hash.h:226
std::pair< const_iterator, const_iterator > equal_range(const K &key, std::size_t hash) const
Definition: robin_hash.h:953
static constexpr float MINIMUM_MIN_LOAD_FACTOR
Definition: robin_hash.h:1289
truncated_hash_type truncated_hash() const noexcept
Definition: robin_hash.h:88
const_iterator begin() const noexcept
Definition: robin_hash.h:625
distance_type m_dist_from_ideal_bucket
Definition: robin_hash.h:282
void clear() noexcept
Definition: robin_hash.h:201
Definition: robin_hash.h:47
static constexpr float REHASH_ON_HIGH_NB_PROBES__MIN_LOAD_FACTOR
Definition: robin_hash.h:1301
void max_load_factor(float ml)
Definition: robin_hash.h:991
#define tsl_rh_assert(expr)
Definition: robin_growth_policy.h:40
Allocator allocator_type
Definition: robin_hash.h:328
iterator erase(const_iterator first, const_iterator last)
Definition: robin_hash.h:770
const_iterator find(const K &key, std::size_t hash) const
Definition: robin_hash.h:931
U::value_type & at(const K &key)
Definition: robin_hash.h:867
bucket_entry(const bucket_entry &other) noexcept(std::is_nothrow_copy_constructible< value_type >::value)
Definition: robin_hash.h:151
iterator find(const K &key)
Definition: robin_hash.h:919
bool m_last_bucket
Definition: robin_hash.h:283
std::pair< iterator, bool > insert_impl(const K &key, Args &&... value_type_args)
Definition: robin_hash.h:1114
truncated_hash_type truncated_hash() const noexcept
Definition: robin_hash.h:102
robin_hash & operator=(const robin_hash &other)
Definition: robin_hash.h:579
Definition: robin_hash.h:52
bool m_try_skrink_on_next_insert
Definition: robin_hash.h:1345
typename std::aligned_storage< sizeof(value_type), alignof(value_type)>::type storage
Definition: robin_hash.h:278
static constexpr float MINIMUM_MAX_LOAD_FACTOR
Definition: robin_hash.h:1285
bool bucket_hash_equal(std::size_t) const noexcept
Definition: robin_hash.h:86
void insert_value(std::size_t ibucket, distance_type dist_from_ideal_bucket, truncated_hash_type hash, value_type &&value)
Definition: robin_hash.h:1167
robin_iterator(const robin_iterator<!TIsConst > &other) noexcept
Definition: robin_hash.h:418
static constexpr float MAXIMUM_MAX_LOAD_FACTOR
Definition: robin_hash.h:1286
std::pair< iterator, iterator > equal_range(const K &key, std::size_t hash)
Definition: robin_hash.h:941
#define TSL_RH_THROW_OR_TERMINATE(ex, msg)
Definition: robin_growth_policy.h:56
void set_hash(truncated_hash_type) noexcept
Definition: robin_hash.h:91
std::ptrdiff_t difference_type
Definition: robin_hash.h:410
Definition: robin_hash.h:129
key_equal key_eq() const
Definition: robin_hash.h:1014
value_type * pointer
Definition: robin_hash.h:412
std::vector< char > data
Definition: cth_pressure_map.C:73
U::value_type & operator[](K &&key)
Definition: robin_hash.h:902
robin_iterator & operator=(const robin_iterator &other)=default
robin_iterator() noexcept
Definition: robin_hash.h:414
static const size_type DEFAULT_INIT_BUCKETS_SIZE
Definition: robin_hash.h:1282
buckets_container_type m_buckets_data
Definition: robin_hash.h:1313
Hash hasher
Definition: robin_hash.h:326
bucket_entry() noexcept
Definition: robin_hash.h:137
storage m_value
Definition: robin_hash.h:284
float m_max_load_factor
Definition: robin_hash.h:1333
static constexpr float MAXIMUM_MIN_LOAD_FACTOR
Definition: robin_hash.h:1290
reference operator *() const
Definition: robin_hash.h:443
static constexpr float DEFAULT_MAX_LOAD_FACTOR
Definition: robin_hash.h:1284
hasher hash_function() const
Definition: robin_hash.h:1012
void insert_value(std::size_t ibucket, distance_type dist_from_ideal_bucket, truncated_hash_type hash, Args &&... value_type_args)
Definition: robin_hash.h:1160
robin_iterator< false > iterator
Definition: robin_hash.h:333
robin_hash(robin_hash &&other) noexcept(std::is_nothrow_move_constructible< Hash >::value &&std::is_nothrow_move_constructible< KeyEqual >::value &&std::is_nothrow_move_constructible< GrowthPolicy >::value &&std::is_nothrow_move_constructible< buckets_container_type >::value)
Definition: robin_hash.h:554
std::pair< iterator, bool > emplace(Args &&... args)
Definition: robin_hash.h:719
~bucket_entry() noexcept
Definition: robin_hash.h:199
Definition: robin_hash.h:308
void insert_value_impl(std::size_t ibucket, distance_type dist_from_ideal_bucket, truncated_hash_type hash, value_type &value)
Definition: robin_hash.h:1180
iterator insert_or_assign(const_iterator hint, K &&key, M &&obj)
Definition: robin_hash.h:707
typename bucket_entry::distance_type distance_type
Definition: robin_hash.h:379
size_type erase(const K &key)
Definition: robin_hash.h:828
static truncated_hash_type truncate_hash(std::size_t hash) noexcept
Definition: robin_hash.h:265
iterator try_emplace_hint(const_iterator hint, K &&key, Args &&... args)
Definition: robin_hash.h:738
bool last_bucket() const noexcept
Definition: robin_hash.h:228
typename std::allocator_traits< allocator_type >::template rebind_alloc< bucket_entry > buckets_allocator
Definition: robin_hash.h:382
std::ptrdiff_t difference_type
Definition: robin_hash.h:325
value_type & reference
Definition: robin_hash.h:411
float max_load_factor() const
Definition: robin_hash.h:983
const_iterator end() const noexcept
Definition: robin_hash.h:639
Definition: robin_growth_policy.h:80
robin_iterator & operator++()
Definition: robin_hash.h:447
void reserve(size_type my_count)
Definition: robin_hash.h:1004
bool empty() const noexcept
Definition: robin_hash.h:646
float min_load_factor() const
Definition: robin_hash.h:981
static constexpr bool USE_STORED_HASH_ON_LOOKUP
Definition: robin_hash.h:355
void type
Definition: robin_hash.h:49
value_type * pointer
Definition: robin_hash.h:331
void swap_with_value_in_bucket(distance_type &my_dist_from_ideal_bucket, truncated_hash_type &hash, value_type &my_value)
Definition: robin_hash.h:247
allocator_type get_allocator() const
Definition: robin_hash.h:610
Definition: robin_hash.h:83
size_type erase(const K &key, std::size_t hash)
Definition: robin_hash.h:830
void rehash(size_type my_count)
Definition: robin_hash.h:998
U::value_type & at(const K &key, std::size_t hash)
Definition: robin_hash.h:874