IOSS  2.0
robin_hash.h
Go to the documentation of this file.
1 /**
2  * MIT License
3  *
4  * Copyright (c) 2017 Tessil
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef TSL_ROBIN_HASH_H
25 #define TSL_ROBIN_HASH_H
26 
27 #include "robin_growth_policy.h"
28 #include <algorithm>
29 #include <cassert>
30 #include <cmath>
31 #include <cstddef>
32 #include <cstdint>
33 #include <exception>
34 #include <iterator>
35 #include <limits>
36 #include <memory>
37 #include <stdexcept>
38 #include <tuple>
39 #include <type_traits>
40 #include <utility>
41 #include <vector>
42 
43 namespace tsl {
44 
45  namespace detail_robin_hash {
46 
47  template <typename T> struct make_void
48  {
49  using type = void;
50  };
51 
52  template <typename T, typename = void> struct has_is_transparent : std::false_type
53  {
54  };
55 
56  template <typename T>
57  struct has_is_transparent<T, typename make_void<typename T::is_transparent>::type>
58  : std::true_type
59  {
60  };
61 
62  template <typename U> struct is_power_of_two_policy : std::false_type
63  {
64  };
65 
66  template <std::size_t GrowthFactor>
68  : std::true_type
69  {
70  };
71 
72  // Only available in C++17, we need to be compatible with C++11
73  template <class T> const T &clamp(const T &v, const T &lo, const T &hi)
74  {
75  return std::min(hi, std::max(lo, v));
76  }
77 
78  template <typename T, typename U>
79  static T numeric_cast(U value, const char *error_message = "numeric_cast() failed.")
80  {
81  T ret = static_cast<T>(value);
82  if (static_cast<U>(ret) != value) {
83  TSL_RH_THROW_OR_TERMINATE(std::runtime_error, error_message);
84  }
85 
86  const bool is_same_signedness = (std::is_unsigned<T>::value && std::is_unsigned<U>::value) ||
87  (std::is_signed<T>::value && std::is_signed<U>::value);
88  if (!is_same_signedness && (ret < T{}) != (value < U{})) {
89  TSL_RH_THROW_OR_TERMINATE(std::runtime_error, error_message);
90  }
91 
92  return ret;
93  }
94 
95  using truncated_hash_type = std::uint_least32_t;
96 
97  /**
98  * Helper class that stores a truncated hash if StoreHash is true and nothing otherwise.
99  */
100  template <bool StoreHash> class bucket_entry_hash
101  {
102  public:
103  bool bucket_hash_equal(std::size_t /*hash*/) const noexcept { return true; }
104 
105  truncated_hash_type truncated_hash() const noexcept { return 0; }
106 
107  protected:
108  void set_hash(truncated_hash_type /*hash*/) noexcept {}
109  };
110 
111  template <> class bucket_entry_hash<true>
112  {
113  public:
114  bool bucket_hash_equal(std::size_t hash) const noexcept
115  {
116  return m_hash == truncated_hash_type(hash);
117  }
118 
119  truncated_hash_type truncated_hash() const noexcept { return m_hash; }
120 
121  protected:
122  void set_hash(truncated_hash_type hash) noexcept { m_hash = truncated_hash_type(hash); }
123 
124  private:
126  };
127 
128  /**
129  * Each bucket entry has:
130  * - A value of type `ValueType`.
131  * - An integer to store how far the value of the bucket, if any, is from its ideal bucket
132  * (ex: if the current bucket 5 has the value 'foo' and `hash('foo') % nb_buckets` == 3,
133  * `dist_from_ideal_bucket()` will return 2 as the current value of the bucket is two
134  * buckets away from its ideal bucket)
135  * If there is no value in the bucket (i.e. `empty()` is true) `dist_from_ideal_bucket()` will
136  * be < 0.
137  * - A marker which tells us if the bucket is the last bucket of the bucket array (useful for
138  * the iterator of the hash table).
139  * - If `StoreHash` is true, 32 bits of the hash of the value, if any, are also stored in the
140  * bucket. If the size of the hash is more than 32 bits, it is truncated. We don't store the
141  * full hash as storing the hash is a potential opportunity to use the unused space due to the
142  * alignment of the bucket_entry structure. We can thus potentially store the hash without any
143  * extra space (which would not be possible with 64 bits of the hash).
144  */
145  template <typename ValueType, bool StoreHash>
146  class bucket_entry : public bucket_entry_hash<StoreHash>
147  {
149 
150  public:
151  using value_type = ValueType;
152  using distance_type = std::int_least16_t;
153 
154  bucket_entry() noexcept
156 
157  {
158  tsl_rh_assert(empty());
159  }
160 
161  explicit bucket_entry(bool lst_bucket) noexcept
163  m_last_bucket(lst_bucket)
164  {
165  tsl_rh_assert(empty());
166  }
167 
168  bucket_entry(const bucket_entry &other) noexcept(
169  std::is_nothrow_copy_constructible<value_type>::value)
172  {
173  if (!other.empty()) {
174  ::new (static_cast<void *>(std::addressof(m_value))) value_type(other.value());
175  m_dist_from_ideal_bucket = other.m_dist_from_ideal_bucket;
176  }
177  }
178 
179  /**
180  * Never really used, but still necessary as we must call resize on an empty
181  * `std::vector<bucket_entry>`. and we need to support move-only types. See robin_hash
182  * constructor for details.
183  */
184  bucket_entry(bucket_entry &&other) noexcept(
185  std::is_nothrow_move_constructible<value_type>::value)
186  : bucket_hash(std::move(other)),
189  {
190  if (!other.empty()) {
191  ::new (static_cast<void *>(std::addressof(m_value))) value_type(std::move(other.value()));
192  m_dist_from_ideal_bucket = other.m_dist_from_ideal_bucket;
193  }
194  }
195 
196  bucket_entry &operator=(const bucket_entry &other) noexcept(
197  std::is_nothrow_copy_constructible<value_type>::value)
198  {
199  if (this != &other) {
200  clear();
201 
202  bucket_hash::operator=(other);
203  if (!other.empty()) {
204  ::new (static_cast<void *>(std::addressof(m_value))) value_type(other.value());
205  }
206 
207  m_dist_from_ideal_bucket = other.m_dist_from_ideal_bucket;
208  m_last_bucket = other.m_last_bucket;
209  }
210 
211  return *this;
212  }
213 
215 
216  ~bucket_entry() noexcept { clear(); }
217 
218  void clear() noexcept
219  {
220  if (!empty()) {
221  destroy_value();
223  }
224  }
225 
226  bool empty() const noexcept
227  {
229  }
230 
231  value_type &value() noexcept
232  {
233  tsl_rh_assert(!empty());
234  return *reinterpret_cast<value_type *>(std::addressof(m_value));
235  }
236 
237  const value_type &value() const noexcept
238  {
239  tsl_rh_assert(!empty());
240  return *reinterpret_cast<const value_type *>(std::addressof(m_value));
241  }
242 
244 
245  bool last_bucket() const noexcept { return m_last_bucket; }
246 
247  void set_as_last_bucket() noexcept { m_last_bucket = true; }
248 
249  template <typename... Args>
251  Args &&... value_type_args)
252  {
253  tsl_rh_assert(dist_frm_ideal_bucket >= 0);
254  tsl_rh_assert(empty());
255 
256  ::new (static_cast<void *>(std::addressof(m_value)))
257  value_type(std::forward<Args>(value_type_args)...);
258  this->set_hash(hash);
259  m_dist_from_ideal_bucket = dist_frm_ideal_bucket;
260 
261  tsl_rh_assert(!empty());
262  }
263 
264  void swap_with_value_in_bucket(distance_type & dist_frm_ideal_bucket,
265  truncated_hash_type &hash, value_type &my_value)
266  {
267  tsl_rh_assert(!empty());
268 
269  using std::swap;
270  swap(my_value, this->value());
271  swap(dist_frm_ideal_bucket, m_dist_from_ideal_bucket);
272 
273  // Avoid warning of unused variable if StoreHash is false
274  (void)hash;
275  if (StoreHash) {
276  const truncated_hash_type tmp_hash = this->truncated_hash();
277  this->set_hash(hash);
278  hash = tmp_hash;
279  }
280  }
281 
282  static truncated_hash_type truncate_hash(std::size_t hash) noexcept
283  {
284  return truncated_hash_type(hash);
285  }
286 
287  private:
288  void destroy_value() noexcept
289  {
290  tsl_rh_assert(!empty());
291  value().~value_type();
292  }
293 
294  private:
295  using storage = typename std::aligned_storage<sizeof(value_type), alignof(value_type)>::type;
296 
298 
300  bool m_last_bucket{false};
302  };
303 
304  /**
305  * Internal common class used by `robin_map` and `robin_set`.
306  *
307  * ValueType is what will be stored by `robin_hash` (usually `std::pair<Key, T>` for map and
308  * `Key` for set).
309  *
310  * `KeySelect` should be a `FunctionObject` which takes a `ValueType` in parameter and returns a
311  * reference to the key.
312  *
313  * `ValueSelect` should be a `FunctionObject` which takes a `ValueType` in parameter and returns
314  * a reference to the value. `ValueSelect` should be void if there is no value (in a set for
315  * example).
316  *
317  * The strong exception guarantee only holds if the expression
318  * `std::is_nothrow_swappable<ValueType>\:\:value &&
319  * std::is_nothrow_move_constructible<ValueType>\:\:value` is true.
320  *
321  * Behaviour is undefined if the destructor of `ValueType` throws.
322  */
323  template <class ValueType, class KeySelect, class ValueSelect, class Hash, class KeyEqual,
324  class Allocator, bool StoreHash, class GrowthPolicy>
325  class robin_hash : private Hash, private KeyEqual, private GrowthPolicy
326  {
327  private:
328  template <typename U>
329  using has_mapped_type = typename std::integral_constant<bool, !std::is_same<U, void>::value>;
330 
331  static_assert(noexcept(std::declval<GrowthPolicy>().bucket_for_hash(std::size_t(0))),
332  "GrowthPolicy::bucket_for_hash must be noexcept.");
333  static_assert(noexcept(std::declval<GrowthPolicy>().clear()),
334  "GrowthPolicy::clear must be noexcept.");
335 
336  public:
337  template <bool IsConst> class robin_iterator;
338 
339  using key_type = typename KeySelect::key_type;
340  using value_type = ValueType;
341  using size_type = std::size_t;
342  using difference_type = std::ptrdiff_t;
343  using hasher = Hash;
344  using key_equal = KeyEqual;
345  using allocator_type = Allocator;
347  using const_reference = const value_type &;
348  using pointer = value_type *;
349  using const_pointer = const value_type *;
350  using iterator = robin_iterator<false>;
351  using const_iterator = robin_iterator<true>;
352 
353  private:
354  /**
355  * Either store the hash because we are asked by the `StoreHash` template parameter
356  * or store the hash because it doesn't cost us anything in size and can be used to speed up
357  * rehash.
358  */
359  static constexpr bool STORE_HASH =
362  (sizeof(std::size_t) == sizeof(truncated_hash_type) ||
364  // Don't store the hash for primitive types with default hash.
365  (!std::is_arithmetic<key_type>::value ||
366  !std::is_same<Hash, std::hash<key_type>>::value));
367 
368  /**
369  * Only use the stored hash on lookup if we are explicitly asked. We are not sure how slow
370  * the KeyEqual operation is. An extra comparison may slow things down with a fast KeyEqual.
371  */
372  static constexpr bool USE_STORED_HASH_ON_LOOKUP = StoreHash;
373 
374  /**
375  * We can only use the hash on rehash if the size of the hash type is the same as the stored
376  * one or if we use a power of two modulo. In the case of the power of two modulo, we just
377  * mask the least significant bytes, we just have to check that the truncated_hash_type didn't
378  * truncated more bytes.
379  */
380  static bool USE_STORED_HASH_ON_REHASH(size_type my_bucket_count)
381  {
382  (void)my_bucket_count;
383  if (STORE_HASH && sizeof(std::size_t) == sizeof(truncated_hash_type)) {
384  return true;
385  }
387  tsl_rh_assert(my_bucket_count > 0);
388  return (my_bucket_count - 1) <= std::numeric_limits<truncated_hash_type>::max();
389  }
390  else {
391  return false;
392  }
393  }
394 
397 
399  typename std::allocator_traits<allocator_type>::template rebind_alloc<bucket_entry>;
400  using buckets_container_type = std::vector<bucket_entry, buckets_allocator>;
401 
402  public:
403  /**
404  * The 'operator*()' and 'operator->()' methods return a const reference and const pointer
405  * respectively to the stored value type.
406  *
407  * In case of a map, to get a mutable reference to the value associated to a key (the
408  * '.second' in the stored pair), you have to call 'value()'.
409  *
410  * The main reason for this is that if we returned a `std::pair<Key, T>&` instead
411  * of a `const std::pair<Key, T>&`, the user may modify the key which will put the map in a
412  * undefined state.
413  */
414  template <bool IsConst> class robin_iterator
415  {
416  friend class robin_hash;
417 
418  private:
420  typename std::conditional<IsConst, const bucket_entry *, bucket_entry *>::type;
421 
422  explicit robin_iterator(bucket_entry_ptr bucket) noexcept : m_bucket(bucket) {}
423 
424  public:
425  using iterator_category = std::forward_iterator_tag;
426  using value_type = const typename robin_hash::value_type;
427  using difference_type = std::ptrdiff_t;
429  using pointer = value_type *;
430 
431  robin_iterator() noexcept = default;
432 
433  // Copy constructor from iterator to const_iterator.
434  template <bool TIsConst = IsConst, typename std::enable_if<TIsConst>::type * = nullptr>
435  robin_iterator(const robin_iterator<!TIsConst> &other) noexcept : m_bucket(other.m_bucket)
436  {
437  }
438 
439  robin_iterator(const robin_iterator &other) = default;
440  robin_iterator(robin_iterator &&other) = default;
441  robin_iterator &operator=(const robin_iterator &other) = default;
443 
444  const typename robin_hash::key_type &key() const { return KeySelect()(m_bucket->value()); }
445 
446  template <class U = ValueSelect,
447  typename std::enable_if<has_mapped_type<U>::value && IsConst>::type * = nullptr>
448  const typename U::value_type &value() const
449  {
450  return U()(m_bucket->value());
451  }
452 
453  template <class U = ValueSelect,
454  typename std::enable_if<has_mapped_type<U>::value && !IsConst>::type * = nullptr>
455  typename U::value_type &value()
456  {
457  return U()(m_bucket->value());
458  }
459 
460  reference operator*() const { return m_bucket->value(); }
461 
462  pointer operator->() const { return std::addressof(m_bucket->value()); }
463 
465  {
466  while (true) {
467  if (m_bucket->last_bucket()) {
468  ++m_bucket;
469  return *this;
470  }
471 
472  ++m_bucket;
473  if (!m_bucket->empty()) {
474  return *this;
475  }
476  }
477  }
478 
480  {
481  robin_iterator tmp(*this);
482  ++*this;
483 
484  return tmp;
485  }
486 
487  friend bool operator==(const robin_iterator &lhs, const robin_iterator &rhs)
488  {
489  return lhs.m_bucket == rhs.m_bucket;
490  }
491 
492  friend bool operator!=(const robin_iterator &lhs, const robin_iterator &rhs)
493  {
494  return !(lhs == rhs);
495  }
496 
497  private:
499  };
500 
501  public:
502 #if defined(__cplusplus) && __cplusplus >= 201402L
503  robin_hash(size_type my_bucket_count, const Hash &hash, const KeyEqual &equal,
504  const Allocator &alloc, float min_load_factor = DEFAULT_MIN_LOAD_FACTOR,
506  : Hash(hash), KeyEqual(equal), GrowthPolicy(my_bucket_count),
508  [&]() {
509  if (my_bucket_count > max_bucket_count()) {
510  TSL_RH_THROW_OR_TERMINATE(std::length_error,
511  "The map exceeds its maximum bucket count.");
512  }
513 
514  return my_bucket_count;
515  }(),
516  alloc),
518  m_bucket_count(my_bucket_count), m_nb_elements(0), m_grow_on_next_insert(false),
520  {
521  if (m_bucket_count > 0) {
522  tsl_rh_assert(!m_buckets_data.empty());
523  m_buckets_data.back().set_as_last_bucket();
524  }
525 
528  }
529 #else
530  /**
531  * C++11 doesn't support the creation of a std::vector with a custom allocator and 'count'
532  * default-inserted elements. The needed constructor `explicit vector(size_type count, const
533  * Allocator& alloc = Allocator());` is only available in C++14 and later. We thus must resize
534  * after using the `vector(const Allocator& alloc)` constructor.
535  *
536  * We can't use `vector(size_type count, const T& value, const Allocator& alloc)` as it
537  * requires the value T to be copyable.
538  */
539  robin_hash(size_type my_bucket_count, const Hash &my_hash, const KeyEqual &equal,
540  const Allocator &alloc, float my_min_load_factor = DEFAULT_MIN_LOAD_FACTOR,
541  float my_max_load_factor = DEFAULT_MAX_LOAD_FACTOR)
542  : Hash(my_hash), KeyEqual(equal), GrowthPolicy(my_bucket_count), m_buckets_data(alloc),
545  {
546  if (my_bucket_count > max_bucket_count()) {
547  TSL_RH_THROW_OR_TERMINATE(std::length_error,
548  "The map exceeds its maxmimum bucket count.");
549  }
550 
551  if (m_bucket_count > 0) {
553  m_buckets = m_buckets_data.data();
554 
555  tsl_rh_assert(!m_buckets_data.empty());
556  m_buckets_data.back().set_as_last_bucket();
557  }
558 
559  this->min_load_factor(my_min_load_factor);
560  this->max_load_factor(my_max_load_factor);
561  }
562 #endif
563 
564  robin_hash(const robin_hash &other)
565  : Hash(other), KeyEqual(other), GrowthPolicy(other), m_buckets_data(other.m_buckets_data),
572  {
573  }
574 
575  robin_hash(robin_hash &&other) noexcept(
576  std::is_nothrow_move_constructible<Hash>::value &&std::is_nothrow_move_constructible<
577  KeyEqual>::value &&std::is_nothrow_move_constructible<GrowthPolicy>::value
578  && std::is_nothrow_move_constructible<buckets_container_type>::value)
579  : Hash(std::move(static_cast<Hash &>(other))),
580  KeyEqual(std::move(static_cast<KeyEqual &>(other))),
581  GrowthPolicy(std::move(static_cast<GrowthPolicy &>(other))),
582  m_buckets_data(std::move(other.m_buckets_data)),
589  {
590  other.GrowthPolicy::clear();
591  other.m_buckets_data.clear();
592  other.m_buckets = static_empty_bucket_ptr();
593  other.m_bucket_count = 0;
594  other.m_nb_elements = 0;
595  other.m_load_threshold = 0;
596  other.m_grow_on_next_insert = false;
597  other.m_try_skrink_on_next_insert = false;
598  }
599 
601  {
602  if (&other != this) {
603  Hash:: operator=(other);
604  KeyEqual:: operator=(other);
605  GrowthPolicy::operator=(other);
606 
611 
615 
618  }
619 
620  return *this;
621  }
622 
624  {
625  other.swap(*this);
626  other.clear();
627 
628  return *this;
629  }
630 
631  allocator_type get_allocator() const { return m_buckets_data.get_allocator(); }
632 
633  /*
634  * Iterators
635  */
636  iterator begin() noexcept
637  {
638  std::size_t i = 0;
639  while (i < m_bucket_count && m_buckets[i].empty()) {
640  i++;
641  }
642 
643  return iterator(m_buckets + i);
644  }
645 
646  const_iterator begin() const noexcept { return cbegin(); }
647 
648  const_iterator cbegin() const noexcept
649  {
650  std::size_t i = 0;
651  while (i < m_bucket_count && m_buckets[i].empty()) {
652  i++;
653  }
654 
655  return const_iterator(m_buckets + i);
656  }
657 
658  iterator end() noexcept { return iterator(m_buckets + m_bucket_count); }
659 
660  const_iterator end() const noexcept { return cend(); }
661 
663 
664  /*
665  * Capacity
666  */
667  bool empty() const noexcept { return m_nb_elements == 0; }
668 
669  size_type size() const noexcept { return m_nb_elements; }
670 
671  size_type max_size() const noexcept { return m_buckets_data.max_size(); }
672 
673  /*
674  * Modifiers
675  */
676  void clear() noexcept
677  {
678  for (auto &bucket : m_buckets_data) {
679  bucket.clear();
680  }
681 
682  m_nb_elements = 0;
683  m_grow_on_next_insert = false;
684  }
685 
686  template <typename P> std::pair<iterator, bool> insert(P &&value)
687  {
688  return insert_impl(KeySelect()(value), std::forward<P>(value));
689  }
690 
691  template <typename P> iterator insert_hint(const_iterator hint, P &&value)
692  {
693  if (hint != cend() && compare_keys(KeySelect()(*hint), KeySelect()(value))) {
694  return mutable_iterator(hint);
695  }
696 
697  return insert(std::forward<P>(value)).first;
698  }
699 
700  template <class InputIt> void insert(InputIt first, InputIt last)
701  {
702  if (std::is_base_of<std::forward_iterator_tag,
703  typename std::iterator_traits<InputIt>::iterator_category>::value) {
704  const auto nb_elements_insert = std::distance(first, last);
705  const size_type nb_free_buckets = m_load_threshold - size();
707 
708  if (nb_elements_insert > 0 && nb_free_buckets < size_type(nb_elements_insert)) {
709  reserve(size() + size_type(nb_elements_insert));
710  }
711  }
712 
713  for (; first != last; ++first) {
714  insert(*first);
715  }
716  }
717 
718  template <class K, class M> std::pair<iterator, bool> insert_or_assign(K &&key, M &&obj)
719  {
720  auto it = try_emplace(std::forward<K>(key), std::forward<M>(obj));
721  if (!it.second) {
722  it.first.value() = std::forward<M>(obj);
723  }
724 
725  return it;
726  }
727 
728  template <class K, class M> iterator insert_or_assign(const_iterator hint, K &&key, M &&obj)
729  {
730  if (hint != cend() && compare_keys(KeySelect()(*hint), key)) {
731  auto it = mutable_iterator(hint);
732  it.value() = std::forward<M>(obj);
733 
734  return it;
735  }
736 
737  return insert_or_assign(std::forward<K>(key), std::forward<M>(obj)).first;
738  }
739 
740  template <class... Args> std::pair<iterator, bool> emplace(Args &&... args)
741  {
742  return insert(value_type(std::forward<Args>(args)...));
743  }
744 
745  template <class... Args> iterator emplace_hint(const_iterator hint, Args &&... args)
746  {
747  return insert_hint(hint, value_type(std::forward<Args>(args)...));
748  }
749 
750  template <class K, class... Args>
751  std::pair<iterator, bool> try_emplace(K &&key, Args &&... args)
752  {
753  return insert_impl(key, std::piecewise_construct,
754  std::forward_as_tuple(std::forward<K>(key)),
755  std::forward_as_tuple(std::forward<Args>(args)...));
756  }
757 
758  template <class K, class... Args>
759  iterator try_emplace_hint(const_iterator hint, K &&key, Args &&... args)
760  {
761  if (hint != cend() && compare_keys(KeySelect()(*hint), key)) {
762  return mutable_iterator(hint);
763  }
764 
765  return try_emplace(std::forward<K>(key), std::forward<Args>(args)...).first;
766  }
767 
768  /**
769  * Here to avoid `template<class K> size_type erase(const K& key)` being used when
770  * we use an `iterator` instead of a `const_iterator`.
771  */
773  {
774  erase_from_bucket(pos);
775 
776  /**
777  * Erase bucket used a backward shift after clearing the bucket.
778  * Check if there is a new value in the bucket, if not get the next non-empty.
779  */
780  if (pos.m_bucket->empty()) {
781  ++pos;
782  }
783 
785 
786  return pos;
787  }
788 
790 
792  {
793  if (first == last) {
794  return mutable_iterator(first);
795  }
796 
797  auto first_mutable = mutable_iterator(first);
798  auto last_mutable = mutable_iterator(last);
799  for (auto it = first_mutable.m_bucket; it != last_mutable.m_bucket; ++it) {
800  if (!it->empty()) {
801  it->clear();
802  m_nb_elements--;
803  }
804  }
805 
806  if (last_mutable == end()) {
807  return end();
808  }
809 
810  /*
811  * Backward shift on the values which come after the deleted values.
812  * We try to move the values closer to their ideal bucket.
813  */
814  std::size_t icloser_bucket = static_cast<std::size_t>(first_mutable.m_bucket - m_buckets);
815  std::size_t ito_move_closer_value =
816  static_cast<std::size_t>(last_mutable.m_bucket - m_buckets);
817  tsl_rh_assert(ito_move_closer_value > icloser_bucket);
818 
819  const std::size_t ireturn_bucket =
820  ito_move_closer_value -
821  std::min(ito_move_closer_value - icloser_bucket,
822  std::size_t(m_buckets[ito_move_closer_value].dist_from_ideal_bucket()));
823 
824  while (ito_move_closer_value < m_bucket_count &&
825  m_buckets[ito_move_closer_value].dist_from_ideal_bucket() > 0) {
826  icloser_bucket =
827  ito_move_closer_value -
828  std::min(ito_move_closer_value - icloser_bucket,
829  std::size_t(m_buckets[ito_move_closer_value].dist_from_ideal_bucket()));
830 
831  tsl_rh_assert(m_buckets[icloser_bucket].empty());
832  const distance_type new_distance =
833  distance_type(m_buckets[ito_move_closer_value].dist_from_ideal_bucket() -
834  (ito_move_closer_value - icloser_bucket));
835  m_buckets[icloser_bucket].set_value_of_empty_bucket(
836  new_distance, m_buckets[ito_move_closer_value].truncated_hash(),
837  std::move(m_buckets[ito_move_closer_value].value()));
838  m_buckets[ito_move_closer_value].clear();
839 
840  ++icloser_bucket;
841  ++ito_move_closer_value;
842  }
843 
845 
846  return iterator(m_buckets + ireturn_bucket);
847  }
848 
849  template <class K> size_type erase(const K &key) { return erase(key, hash_key(key)); }
850 
851  template <class K> size_type erase(const K &key, std::size_t my_hash)
852  {
853  auto it = find(key, my_hash);
854  if (it != end()) {
855  erase_from_bucket(it);
857 
858  return 1;
859  }
860 
861  return 0;
862  }
863 
864  void swap(robin_hash &other)
865  {
866  using std::swap;
867 
868  swap(static_cast<Hash &>(*this), static_cast<Hash &>(other));
869  swap(static_cast<KeyEqual &>(*this), static_cast<KeyEqual &>(other));
870  swap(static_cast<GrowthPolicy &>(*this), static_cast<GrowthPolicy &>(other));
872  swap(m_buckets, other.m_buckets);
880  }
881 
882  /*
883  * Lookup
884  */
885  template <class K, class U = ValueSelect,
886  typename std::enable_if<has_mapped_type<U>::value>::type * = nullptr>
887  typename U::value_type &at(const K &key)
888  {
889  return at(key, hash_key(key));
890  }
891 
892  template <class K, class U = ValueSelect,
893  typename std::enable_if<has_mapped_type<U>::value>::type * = nullptr>
894  typename U::value_type &at(const K &key, std::size_t my_hash)
895  {
896  return const_cast<typename U::value_type &>(
897  static_cast<const robin_hash *>(this)->at(key, my_hash));
898  }
899 
900  template <class K, class U = ValueSelect,
901  typename std::enable_if<has_mapped_type<U>::value>::type * = nullptr>
902  const typename U::value_type &at(const K &key) const
903  {
904  return at(key, hash_key(key));
905  }
906 
907  template <class K, class U = ValueSelect,
908  typename std::enable_if<has_mapped_type<U>::value>::type * = nullptr>
909  const typename U::value_type &at(const K &key, std::size_t my_hash) const
910  {
911  auto it = find(key, my_hash);
912  if (it != cend()) {
913  return it.value();
914  }
915  else {
916  TSL_RH_THROW_OR_TERMINATE(std::out_of_range, "Couldn't find key.");
917  }
918  }
919 
920  template <class K, class U = ValueSelect,
921  typename std::enable_if<has_mapped_type<U>::value>::type * = nullptr>
922  typename U::value_type &operator[](K &&key)
923  {
924  return try_emplace(std::forward<K>(key)).first.value();
925  }
926 
927  template <class K> size_type count(const K &key) const { return count(key, hash_key(key)); }
928 
929  template <class K> size_type count(const K &key, std::size_t my_hash) const
930  {
931  if (find(key, my_hash) != cend()) {
932  return 1;
933  }
934  else {
935  return 0;
936  }
937  }
938 
939  template <class K> iterator find(const K &key) { return find_impl(key, hash_key(key)); }
940 
941  template <class K> iterator find(const K &key, std::size_t my_hash)
942  {
943  return find_impl(key, my_hash);
944  }
945 
946  template <class K> const_iterator find(const K &key) const
947  {
948  return find_impl(key, hash_key(key));
949  }
950 
951  template <class K> const_iterator find(const K &key, std::size_t my_hash) const
952  {
953  return find_impl(key, my_hash);
954  }
955 
956  template <class K> std::pair<iterator, iterator> equal_range(const K &key)
957  {
958  return equal_range(key, hash_key(key));
959  }
960 
961  template <class K>
962  std::pair<iterator, iterator> equal_range(const K &key, std::size_t my_hash)
963  {
964  iterator it = find(key, my_hash);
965  return std::make_pair(it, (it == end()) ? it : std::next(it));
966  }
967 
968  template <class K> std::pair<const_iterator, const_iterator> equal_range(const K &key) const
969  {
970  return equal_range(key, hash_key(key));
971  }
972 
973  template <class K>
974  std::pair<const_iterator, const_iterator> equal_range(const K &key, std::size_t my_hash) const
975  {
976  const_iterator it = find(key, my_hash);
977  return std::make_pair(it, (it == cend()) ? it : std::next(it));
978  }
979 
980  /*
981  * Bucket interface
982  */
984 
986  {
987  return std::min(GrowthPolicy::max_bucket_count(), m_buckets_data.max_size());
988  }
989 
990  /*
991  * Hash policy
992  */
993  float load_factor() const
994  {
995  if (bucket_count() == 0) {
996  return 0;
997  }
998 
999  return float(m_nb_elements) / float(bucket_count());
1000  }
1001 
1002  float min_load_factor() const { return m_min_load_factor; }
1003 
1004  float max_load_factor() const { return m_max_load_factor; }
1005 
1006  void min_load_factor(float ml)
1007  {
1010  }
1011 
1012  void max_load_factor(float ml)
1013  {
1017  }
1018 
1019  void rehash(size_type new_count)
1020  {
1021  new_count = std::max(new_count, size_type(std::ceil(float(size()) / max_load_factor())));
1022  rehash_impl(new_count);
1023  }
1024 
1025  void reserve(size_type new_count)
1026  {
1027  rehash(size_type(std::ceil(float(new_count) / max_load_factor())));
1028  }
1029 
1030  /*
1031  * Observers
1032  */
1033  hasher hash_function() const { return static_cast<const Hash &>(*this); }
1034 
1035  key_equal key_eq() const { return static_cast<const KeyEqual &>(*this); }
1036 
1037  /*
1038  * Other
1039  */
1041  {
1042  return iterator(const_cast<bucket_entry *>(pos.m_bucket));
1043  }
1044 
1045  private:
1046  template <class K> std::size_t hash_key(const K &key) const { return Hash::operator()(key); }
1047 
1048  template <class K1, class K2> bool compare_keys(const K1 &key1, const K2 &key2) const
1049  {
1050  return KeyEqual::operator()(key1, key2);
1051  }
1052 
1053  std::size_t bucket_for_hash(std::size_t my_hash) const
1054  {
1055  const std::size_t bucket = GrowthPolicy::bucket_for_hash(my_hash);
1056  tsl_rh_assert(bucket < m_bucket_count || (bucket == 0 && m_bucket_count == 0));
1057 
1058  return bucket;
1059  }
1060 
1061  template <class U = GrowthPolicy,
1062  typename std::enable_if<is_power_of_two_policy<U>::value>::type * = nullptr>
1063  std::size_t next_bucket(std::size_t index) const noexcept
1064  {
1065  tsl_rh_assert(index < bucket_count());
1066 
1067  return (index + 1) & this->m_mask;
1068  }
1069 
1070  template <class U = GrowthPolicy,
1071  typename std::enable_if<!is_power_of_two_policy<U>::value>::type * = nullptr>
1072  std::size_t next_bucket(std::size_t index) const noexcept
1073  {
1074  tsl_rh_assert(index < bucket_count());
1075 
1076  index++;
1077  return (index != bucket_count()) ? index : 0;
1078  }
1079 
1080  template <class K> iterator find_impl(const K &key, std::size_t my_hash)
1081  {
1082  return mutable_iterator(static_cast<const robin_hash *>(this)->find(key, my_hash));
1083  }
1084 
1085  template <class K> const_iterator find_impl(const K &key, std::size_t my_hash) const
1086  {
1087  std::size_t ibucket = bucket_for_hash(my_hash);
1088  distance_type dist_from_ideal_bucket = 0;
1089 
1090  while (dist_from_ideal_bucket <= m_buckets[ibucket].dist_from_ideal_bucket()) {
1091  if (TSL_RH_LIKELY(
1092  (!USE_STORED_HASH_ON_LOOKUP || m_buckets[ibucket].bucket_hash_equal(my_hash)) &&
1093  compare_keys(KeySelect()(m_buckets[ibucket].value()), key))) {
1094  return const_iterator(m_buckets + ibucket);
1095  }
1096 
1097  ibucket = next_bucket(ibucket);
1098  dist_from_ideal_bucket++;
1099  }
1100 
1101  return cend();
1102  }
1103 
1105  {
1106  pos.m_bucket->clear();
1107  --m_nb_elements;
1108 
1109  /**
1110  * Backward shift, swap the empty bucket, previous_ibucket, with the values on its right,
1111  * ibucket, until we cross another empty bucket or if the other bucket has a
1112  * distance_from_ideal_bucket == 0.
1113  *
1114  * We try to move the values closer to their ideal bucket.
1115  */
1116  std::size_t previous_ibucket = static_cast<std::size_t>(pos.m_bucket - m_buckets);
1117  std::size_t ibucket = next_bucket(previous_ibucket);
1118 
1119  while (m_buckets[ibucket].dist_from_ideal_bucket() > 0) {
1120  tsl_rh_assert(m_buckets[previous_ibucket].empty());
1121 
1122  const distance_type new_distance =
1123  distance_type(m_buckets[ibucket].dist_from_ideal_bucket() - 1);
1124  m_buckets[previous_ibucket].set_value_of_empty_bucket(
1125  new_distance, m_buckets[ibucket].truncated_hash(),
1126  std::move(m_buckets[ibucket].value()));
1127  m_buckets[ibucket].clear();
1128 
1129  previous_ibucket = ibucket;
1130  ibucket = next_bucket(ibucket);
1131  }
1132  }
1133 
1134  template <class K, class... Args>
1135  std::pair<iterator, bool> insert_impl(const K &key, Args &&... value_type_args)
1136  {
1137  const std::size_t my_hash = hash_key(key);
1138 
1139  std::size_t ibucket = bucket_for_hash(my_hash);
1140  distance_type dist_from_ideal_bucket = 0;
1141 
1142  while (dist_from_ideal_bucket <= m_buckets[ibucket].dist_from_ideal_bucket()) {
1143  if ((!USE_STORED_HASH_ON_LOOKUP || m_buckets[ibucket].bucket_hash_equal(my_hash)) &&
1144  compare_keys(KeySelect()(m_buckets[ibucket].value()), key)) {
1145  return std::make_pair(iterator(m_buckets + ibucket), false);
1146  }
1147 
1148  ibucket = next_bucket(ibucket);
1149  dist_from_ideal_bucket++;
1150  }
1151 
1152  if (rehash_on_extreme_load()) {
1153  ibucket = bucket_for_hash(my_hash);
1154  dist_from_ideal_bucket = 0;
1155 
1156  while (dist_from_ideal_bucket <= m_buckets[ibucket].dist_from_ideal_bucket()) {
1157  ibucket = next_bucket(ibucket);
1158  dist_from_ideal_bucket++;
1159  }
1160  }
1161 
1162  if (m_buckets[ibucket].empty()) {
1163  m_buckets[ibucket].set_value_of_empty_bucket(dist_from_ideal_bucket,
1164  bucket_entry::truncate_hash(my_hash),
1165  std::forward<Args>(value_type_args)...);
1166  }
1167  else {
1168  insert_value(ibucket, dist_from_ideal_bucket, bucket_entry::truncate_hash(my_hash),
1169  std::forward<Args>(value_type_args)...);
1170  }
1171 
1172  ++m_nb_elements;
1173  /*
1174  * The value will be inserted in ibucket in any case, either because it was
1175  * empty or by stealing the bucket (robin hood).
1176  */
1177  return std::make_pair(iterator(m_buckets + ibucket), true);
1178  }
1179 
1180  template <class... Args>
1181  void insert_value(std::size_t ibucket, distance_type dist_from_ideal_bucket,
1182  truncated_hash_type my_hash, Args &&... value_type_args)
1183  {
1184  value_type value(std::forward<Args>(value_type_args)...);
1185  insert_value_impl(ibucket, dist_from_ideal_bucket, my_hash, value);
1186  }
1187 
1188  void insert_value(std::size_t ibucket, distance_type dist_from_ideal_bucket,
1189  truncated_hash_type my_hash, value_type &&value)
1190  {
1191  insert_value_impl(ibucket, dist_from_ideal_bucket, my_hash, value);
1192  }
1193 
1194  /*
1195  * We don't use `value_type&& value` as last argument due to a bug in MSVC when `value_type`
1196  * is a pointer, The compiler is not able to see the difference between `std::string*` and
1197  * `std::string*&&` resulting in compile error.
1198  *
1199  * The `value` will be in a moved state at the end of the function.
1200  */
1201  void insert_value_impl(std::size_t ibucket, distance_type dist_from_ideal_bucket,
1202  truncated_hash_type my_hash, value_type &value)
1203  {
1204  m_buckets[ibucket].swap_with_value_in_bucket(dist_from_ideal_bucket, my_hash, value);
1205  ibucket = next_bucket(ibucket);
1206  dist_from_ideal_bucket++;
1207 
1208  while (!m_buckets[ibucket].empty()) {
1209  if (dist_from_ideal_bucket > m_buckets[ibucket].dist_from_ideal_bucket()) {
1210  if (dist_from_ideal_bucket >= REHASH_ON_HIGH_NB_PROBES__NPROBES &&
1212  /**
1213  * The number of probes is really high, rehash the map on the next insert.
1214  * Difficult to do now as rehash may throw an exception.
1215  */
1216  m_grow_on_next_insert = true;
1217  }
1218 
1219  m_buckets[ibucket].swap_with_value_in_bucket(dist_from_ideal_bucket, my_hash, value);
1220  }
1221 
1222  ibucket = next_bucket(ibucket);
1223  dist_from_ideal_bucket++;
1224  }
1225 
1226  m_buckets[ibucket].set_value_of_empty_bucket(dist_from_ideal_bucket, my_hash,
1227  std::move(value));
1228  }
1229 
1230  void rehash_impl(size_type new_count)
1231  {
1232  robin_hash new_table(new_count, static_cast<Hash &>(*this), static_cast<KeyEqual &>(*this),
1234 
1235  const bool use_stored_hash = USE_STORED_HASH_ON_REHASH(new_table.bucket_count());
1236  for (auto &bucket : m_buckets_data) {
1237  if (bucket.empty()) {
1238  continue;
1239  }
1240 
1241  const std::size_t my_hash = use_stored_hash
1242  ? bucket.truncated_hash()
1243  : new_table.hash_key(KeySelect()(bucket.value()));
1244 
1245  new_table.insert_value_on_rehash(new_table.bucket_for_hash(my_hash), 0,
1246  bucket_entry::truncate_hash(my_hash),
1247  std::move(bucket.value()));
1248  }
1249 
1250  new_table.m_nb_elements = m_nb_elements;
1251  new_table.swap(*this);
1252  }
1253 
1254  void insert_value_on_rehash(std::size_t ibucket, distance_type dist_from_ideal_bucket,
1255  truncated_hash_type my_hash, value_type &&value)
1256  {
1257  while (true) {
1258  if (dist_from_ideal_bucket > m_buckets[ibucket].dist_from_ideal_bucket()) {
1259  if (m_buckets[ibucket].empty()) {
1260  m_buckets[ibucket].set_value_of_empty_bucket(dist_from_ideal_bucket, my_hash,
1261  std::move(value));
1262  return;
1263  }
1264  else {
1265  m_buckets[ibucket].swap_with_value_in_bucket(dist_from_ideal_bucket, my_hash, value);
1266  }
1267  }
1268 
1269  ++dist_from_ideal_bucket;
1270  ibucket = next_bucket(ibucket);
1271  }
1272  }
1273 
1274  /**
1275  * Grow the table if m_grow_on_next_insert is true or we reached the max_load_factor.
1276  * Shrink the table if m_try_skrink_on_next_insert is true (an erase occurred) and
1277  * we're below the min_load_factor.
1278  *
1279  * Return true if the table has been rehashed.
1280  */
1282  {
1284  rehash_impl(GrowthPolicy::next_bucket_count());
1285  m_grow_on_next_insert = false;
1286 
1287  return true;
1288  }
1289 
1292  if (m_min_load_factor != 0.0f && load_factor() < m_min_load_factor) {
1293  reserve(size() + 1);
1294 
1295  return true;
1296  }
1297  }
1298 
1299  return false;
1300  }
1301 
1302  public:
1304 
1305  static constexpr float DEFAULT_MAX_LOAD_FACTOR = 0.5f;
1306  static constexpr float MINIMUM_MAX_LOAD_FACTOR = 0.2f;
1307  static constexpr float MAXIMUM_MAX_LOAD_FACTOR = 0.95f;
1308 
1309  static constexpr float DEFAULT_MIN_LOAD_FACTOR = 0.0f;
1310  static constexpr float MINIMUM_MIN_LOAD_FACTOR = 0.0f;
1311  static constexpr float MAXIMUM_MIN_LOAD_FACTOR = 0.15f;
1312 
1314  "MINIMUM_MAX_LOAD_FACTOR should be < MAXIMUM_MAX_LOAD_FACTOR");
1316  "MINIMUM_MIN_LOAD_FACTOR should be < MAXIMUM_MIN_LOAD_FACTOR");
1318  "MAXIMUM_MIN_LOAD_FACTOR should be < MINIMUM_MAX_LOAD_FACTOR");
1319 
1320  private:
1322  static constexpr float REHASH_ON_HIGH_NB_PROBES__MIN_LOAD_FACTOR = 0.15f;
1323 
1324  /**
1325  * Return an always valid pointer to an static empty bucket_entry with last_bucket() == true.
1326  */
1328  {
1329  static bucket_entry empty_bucket(true);
1330  return &empty_bucket;
1331  }
1332 
1333  private:
1335 
1336  /**
1337  * Points to m_buckets_data.data() if !m_buckets_data.empty() otherwise points to
1338  * static_empty_bucket_ptr. This variable is useful to avoid the cost of checking if
1339  * m_buckets_data is empty when trying to find an element.
1340  *
1341  * TODO Remove m_buckets_data and only use a pointer instead of a pointer+vector to save some
1342  * space in the robin_hash object. Manage the Allocator manually.
1343  */
1345 
1346  /**
1347  * Used a lot in find, avoid the call to m_buckets_data.size() which is a bit slower.
1348  */
1350 
1352 
1355 
1357 
1359 
1360  /**
1361  * We can't shrink down the map on erase operations as the erase methods need to return the
1362  * next iterator. Shrinking the map would invalidate all the iterators and we could not return
1363  * the next iterator in a meaningful way, On erase, we thus just indicate on erase that we
1364  * should try to shrink the hash table on the next insert if we go below the min_load_factor.
1365  */
1367  };
1368 
1369  } // namespace detail_robin_hash
1370 
1371 } // namespace tsl
1372 
1373 #endif
tsl::detail_robin_hash::robin_hash::robin_iterator::robin_iterator
robin_iterator() noexcept=default
tsl::detail_robin_hash::robin_hash::insert_value
void insert_value(std::size_t ibucket, distance_type dist_from_ideal_bucket, truncated_hash_type my_hash, value_type &&value)
Definition: robin_hash.h:1188
tsl::detail_robin_hash::bucket_entry::bucket_entry
bucket_entry(const bucket_entry &other) noexcept(std::is_nothrow_copy_constructible< value_type >::value)
Definition: robin_hash.h:168
tsl::detail_robin_hash::robin_hash::equal_range
std::pair< const_iterator, const_iterator > equal_range(const K &key) const
Definition: robin_hash.h:968
tsl
Definition: bhopscotch_map.h:37
tsl::detail_robin_hash::robin_hash::erase
size_type erase(const K &key, std::size_t my_hash)
Definition: robin_hash.h:851
tsl::detail_robin_hash::is_power_of_two_policy
Definition: robin_hash.h:63
tsl::detail_robin_hash::robin_hash::find_impl
const_iterator find_impl(const K &key, std::size_t my_hash) const
Definition: robin_hash.h:1085
tsl::detail_robin_hash::robin_hash::bucket_for_hash
std::size_t bucket_for_hash(std::size_t my_hash) const
Definition: robin_hash.h:1053
tsl::detail_robin_hash::robin_hash::m_load_threshold
size_type m_load_threshold
Definition: robin_hash.h:1353
tsl::detail_robin_hash::robin_hash::hash_function
hasher hash_function() const
Definition: robin_hash.h:1033
tsl::detail_robin_hash::robin_hash::size
size_type size() const noexcept
Definition: robin_hash.h:669
tsl::detail_robin_hash::robin_hash::max_load_factor
float max_load_factor() const
Definition: robin_hash.h:1004
tsl::detail_robin_hash::robin_hash::find
const_iterator find(const K &key, std::size_t my_hash) const
Definition: robin_hash.h:951
tsl::detail_robin_hash::bucket_entry::storage
typename std::aligned_storage< sizeof(value_type), alignof(value_type)>::type storage
Definition: robin_hash.h:295
tsl::detail_robin_hash::bucket_entry::dist_from_ideal_bucket
distance_type dist_from_ideal_bucket() const noexcept
Definition: robin_hash.h:243
tsl::detail_robin_hash::robin_hash::DEFAULT_MIN_LOAD_FACTOR
static constexpr float DEFAULT_MIN_LOAD_FACTOR
Definition: robin_hash.h:1309
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::has_mapped_type
typename std::integral_constant< bool, !std::is_same< U, void >::value > has_mapped_type
Definition: robin_hash.h:329
tsl::detail_robin_hash::robin_hash::emplace
std::pair< iterator, bool > emplace(Args &&... args)
Definition: robin_hash.h:740
tsl::detail_robin_hash::make_void::type
void type
Definition: robin_hash.h:49
tsl::detail_robin_hash::make_void
Definition: robin_hash.h:48
robin_growth_policy.h
tsl::detail_robin_hash::robin_hash::insert_or_assign
iterator insert_or_assign(const_iterator hint, K &&key, M &&obj)
Definition: robin_hash.h:728
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::pointer
value_type * pointer
Definition: robin_hash.h:348
tsl::detail_robin_hash::robin_hash::robin_iterator::value
U::value_type & value()
Definition: robin_hash.h:455
tsl::detail_robin_hash::bucket_entry::set_as_last_bucket
void set_as_last_bucket() noexcept
Definition: robin_hash.h:247
tsl::detail_robin_hash::clamp
const T & clamp(const T &v, const T &lo, const T &hi)
Definition: robin_hash.h:73
tsl::detail_robin_hash::robin_hash::STORE_HASH
static constexpr bool STORE_HASH
Definition: robin_hash.h:359
tsl::detail_robin_hash::robin_hash::erase
size_type erase(const K &key)
Definition: robin_hash.h:849
tsl::detail_robin_hash::robin_hash::robin_iterator::robin_iterator
robin_iterator(bucket_entry_ptr bucket) noexcept
Definition: robin_hash.h:422
tsl::detail_robin_hash::bucket_entry::last_bucket
bool last_bucket() const noexcept
Definition: robin_hash.h:245
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::difference_type
std::ptrdiff_t difference_type
Definition: robin_hash.h:342
tsl::detail_robin_hash::bucket_entry_hash::bucket_hash_equal
bool bucket_hash_equal(std::size_t) const noexcept
Definition: robin_hash.h:103
tsl::detail_robin_hash::bucket_entry::m_value
storage m_value
Definition: robin_hash.h:301
tsl::detail_robin_hash::bucket_entry::bucket_entry
bucket_entry() noexcept
Definition: robin_hash.h:154
tsl::detail_robin_hash::bucket_entry::~bucket_entry
~bucket_entry() noexcept
Definition: robin_hash.h:216
tsl::detail_robin_hash::robin_hash::empty
bool empty() const noexcept
Definition: robin_hash.h:667
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::size_type
std::size_t size_type
Definition: robin_hash.h:341
tsl::detail_robin_hash::bucket_entry_hash< true >::m_hash
truncated_hash_type m_hash
Definition: robin_hash.h:125
TSL_RH_LIKELY
#define TSL_RH_LIKELY(exp)
Definition: robin_growth_policy.h:68
tsl::detail_robin_hash::bucket_entry_hash::set_hash
void set_hash(truncated_hash_type) noexcept
Definition: robin_hash.h:108
tsl::detail_robin_hash::robin_hash::robin_iterator::pointer
value_type * pointer
Definition: robin_hash.h:429
tsl::detail_robin_hash::robin_hash::m_buckets
bucket_entry * m_buckets
Definition: robin_hash.h:1344
tsl::detail_robin_hash::bucket_entry::m_last_bucket
bool m_last_bucket
Definition: robin_hash.h:300
tsl::detail_robin_hash::robin_hash::robin_hash
robin_hash(size_type my_bucket_count, const Hash &my_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:539
tsl::detail_robin_hash::robin_hash::robin_iterator::difference_type
std::ptrdiff_t difference_type
Definition: robin_hash.h:427
tsl::detail_robin_hash::robin_hash::m_grow_on_next_insert
bool m_grow_on_next_insert
Definition: robin_hash.h:1356
tsl::detail_robin_hash::robin_hash::operator=
robin_hash & operator=(robin_hash &&other)
Definition: robin_hash.h:623
tsl::detail_robin_hash::truncated_hash_type
std::uint_least32_t truncated_hash_type
Definition: robin_hash.h:95
tsl::detail_robin_hash::robin_hash::compare_keys
bool compare_keys(const K1 &key1, const K2 &key2) const
Definition: robin_hash.h:1048
tsl::detail_robin_hash::robin_hash::at
U::value_type & at(const K &key)
Definition: robin_hash.h:887
tsl::detail_robin_hash::robin_hash::max_size
size_type max_size() const noexcept
Definition: robin_hash.h:671
tsl::detail_robin_hash::robin_hash::robin_iterator::operator*
reference operator*() const
Definition: robin_hash.h:460
tsl::detail_robin_hash::robin_hash::robin_iterator::operator=
robin_iterator & operator=(robin_iterator &&other)=default
tsl::detail_robin_hash::robin_hash::hash_key
std::size_t hash_key(const K &key) const
Definition: robin_hash.h:1046
tsl::detail_robin_hash::robin_hash::m_min_load_factor
float m_min_load_factor
Definition: robin_hash.h:1358
tsl::detail_robin_hash::robin_hash::rehash
void rehash(size_type new_count)
Definition: robin_hash.h:1019
tsl::detail_robin_hash::robin_hash::insert_hint
iterator insert_hint(const_iterator hint, P &&value)
Definition: robin_hash.h:691
tsl::detail_robin_hash::robin_hash::find
const_iterator find(const K &key) const
Definition: robin_hash.h:946
tsl::detail_robin_hash::bucket_entry::value_type
ValueType value_type
Definition: robin_hash.h:151
tsl::detail_robin_hash::bucket_entry::set_value_of_empty_bucket
void set_value_of_empty_bucket(distance_type dist_frm_ideal_bucket, truncated_hash_type hash, Args &&... value_type_args)
Definition: robin_hash.h:250
tsl::detail_robin_hash::robin_hash::begin
const_iterator begin() const noexcept
Definition: robin_hash.h:646
tsl_rh_assert
#define tsl_rh_assert(expr)
Definition: robin_growth_policy.h:40
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::const_reference
const value_type & const_reference
Definition: robin_hash.h:347
tsl::detail_robin_hash::robin_hash::rehash_on_extreme_load
bool rehash_on_extreme_load()
Definition: robin_hash.h:1281
tsl::detail_robin_hash::robin_hash::erase_from_bucket
void erase_from_bucket(iterator pos)
Definition: robin_hash.h:1104
tsl::detail_robin_hash::robin_hash::clear
void clear() noexcept
Definition: robin_hash.h:676
tsl::detail_robin_hash::robin_hash::REHASH_ON_HIGH_NB_PROBES__MIN_LOAD_FACTOR
static constexpr float REHASH_ON_HIGH_NB_PROBES__MIN_LOAD_FACTOR
Definition: robin_hash.h:1322
tsl::detail_robin_hash::robin_hash::USE_STORED_HASH_ON_REHASH
static bool USE_STORED_HASH_ON_REHASH(size_type my_bucket_count)
Definition: robin_hash.h:380
tsl::detail_robin_hash::robin_hash::robin_iterator
Definition: robin_hash.h:415
tsl::detail_robin_hash::robin_hash::robin_iterator::operator++
robin_iterator operator++(int)
Definition: robin_hash.h:479
tsl::detail_robin_hash::robin_hash::reserve
void reserve(size_type new_count)
Definition: robin_hash.h:1025
tsl::detail_robin_hash::robin_hash::equal_range
std::pair< iterator, iterator > equal_range(const K &key, std::size_t my_hash)
Definition: robin_hash.h:962
tsl::detail_robin_hash::bucket_entry::m_dist_from_ideal_bucket
distance_type m_dist_from_ideal_bucket
Definition: robin_hash.h:299
tsl::detail_robin_hash::robin_hash::robin_iterator::bucket_entry_ptr
typename std::conditional< IsConst, const bucket_entry *, bucket_entry * >::type bucket_entry_ptr
Definition: robin_hash.h:420
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::value_type
Key value_type
Definition: robin_hash.h:340
tsl::detail_robin_hash::robin_hash::equal_range
std::pair< const_iterator, const_iterator > equal_range(const K &key, std::size_t my_hash) const
Definition: robin_hash.h:974
tsl::detail_robin_hash::robin_hash::at
const U::value_type & at(const K &key, std::size_t my_hash) const
Definition: robin_hash.h:909
tsl::detail_robin_hash::robin_hash::find
iterator find(const K &key)
Definition: robin_hash.h:939
tsl::detail_robin_hash::robin_hash::insert_impl
std::pair< iterator, bool > insert_impl(const K &key, Args &&... value_type_args)
Definition: robin_hash.h:1135
tsl::detail_robin_hash::bucket_entry::swap_with_value_in_bucket
void swap_with_value_in_bucket(distance_type &dist_frm_ideal_bucket, truncated_hash_type &hash, value_type &my_value)
Definition: robin_hash.h:264
tsl::detail_robin_hash::robin_hash::cbegin
const_iterator cbegin() const noexcept
Definition: robin_hash.h:648
tsl::detail_robin_hash::bucket_entry::bucket_hash
bucket_entry_hash< StoreHash > bucket_hash
Definition: robin_hash.h:148
tsl::detail_robin_hash::robin_hash::insert_value
void insert_value(std::size_t ibucket, distance_type dist_from_ideal_bucket, truncated_hash_type my_hash, Args &&... value_type_args)
Definition: robin_hash.h:1181
tsl::detail_robin_hash::robin_hash::operator[]
U::value_type & operator[](K &&key)
Definition: robin_hash.h:922
tsl::detail_robin_hash::robin_hash::count
size_type count(const K &key) const
Definition: robin_hash.h:927
tsl::detail_robin_hash::robin_hash::robin_iterator::operator!=
friend bool operator!=(const robin_iterator &lhs, const robin_iterator &rhs)
Definition: robin_hash.h:492
tsl::detail_robin_hash::robin_hash::insert
void insert(InputIt first, InputIt last)
Definition: robin_hash.h:700
tsl::detail_robin_hash::robin_hash::MINIMUM_MAX_LOAD_FACTOR
static constexpr float MINIMUM_MAX_LOAD_FACTOR
Definition: robin_hash.h:1306
tsl::detail_robin_hash::has_is_transparent
Definition: robin_hash.h:53
tsl::detail_robin_hash::robin_hash::DEFAULT_INIT_BUCKETS_SIZE
static const size_type DEFAULT_INIT_BUCKETS_SIZE
Definition: robin_hash.h:1303
tsl::detail_robin_hash::robin_hash::cend
const_iterator cend() const noexcept
Definition: robin_hash.h:662
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::key_equal
std::equal_to< Key > key_equal
Definition: robin_hash.h:344
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::const_pointer
const value_type * const_pointer
Definition: robin_hash.h:349
TSL_RH_THROW_OR_TERMINATE
#define TSL_RH_THROW_OR_TERMINATE(ex, msg)
Definition: robin_growth_policy.h:57
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::hasher
std::hash< Key > hasher
Definition: robin_hash.h:343
tsl::detail_robin_hash::robin_hash::m_max_load_factor
float m_max_load_factor
Definition: robin_hash.h:1354
tsl::detail_robin_hash::bucket_entry::operator=
bucket_entry & operator=(const bucket_entry &other) noexcept(std::is_nothrow_copy_constructible< value_type >::value)
Definition: robin_hash.h:196
tsl::detail_robin_hash::robin_hash::robin_iterator::value_type
const typename robin_hash::value_type value_type
Definition: robin_hash.h:426
tsl::detail_robin_hash::robin_hash::erase
iterator erase(iterator pos)
Definition: robin_hash.h:772
tsl::detail_robin_hash::robin_hash
Definition: robin_hash.h:326
tsl::detail_robin_hash::robin_hash::mutable_iterator
iterator mutable_iterator(const_iterator pos)
Definition: robin_hash.h:1040
tsl::detail_robin_hash::bucket_entry::operator=
bucket_entry & operator=(bucket_entry &&)=delete
tsl::detail_robin_hash::robin_hash::emplace_hint
iterator emplace_hint(const_iterator hint, Args &&... args)
Definition: robin_hash.h:745
tsl::detail_robin_hash::robin_hash::robin_hash
robin_hash(const robin_hash &other)
Definition: robin_hash.h:564
tsl::detail_robin_hash::robin_hash::next_bucket
std::size_t next_bucket(std::size_t index) const noexcept
Definition: robin_hash.h:1063
tsl::detail_robin_hash::robin_hash::m_buckets_data
buckets_container_type m_buckets_data
Definition: robin_hash.h:1334
tsl::detail_robin_hash::bucket_entry_hash< true >::set_hash
void set_hash(truncated_hash_type hash) noexcept
Definition: robin_hash.h:122
tsl::detail_robin_hash::robin_hash::robin_iterator::value
const U::value_type & value() const
Definition: robin_hash.h:448
tsl::detail_robin_hash::bucket_entry::distance_type
std::int_least16_t distance_type
Definition: robin_hash.h:152
tsl::detail_robin_hash::robin_hash::insert_or_assign
std::pair< iterator, bool > insert_or_assign(K &&key, M &&obj)
Definition: robin_hash.h:718
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::buckets_allocator
typename std::allocator_traits< allocator_type >::template rebind_alloc< bucket_entry > buckets_allocator
Definition: robin_hash.h:399
tsl::detail_robin_hash::robin_hash::static_empty_bucket_ptr
bucket_entry * static_empty_bucket_ptr()
Definition: robin_hash.h:1327
tsl::detail_robin_hash::robin_hash::robin_iterator::key
const robin_hash::key_type & key() const
Definition: robin_hash.h:444
tsl::detail_robin_hash::robin_hash::DEFAULT_MAX_LOAD_FACTOR
static constexpr float DEFAULT_MAX_LOAD_FACTOR
Definition: robin_hash.h:1305
tsl::detail_robin_hash::robin_hash::end
const_iterator end() const noexcept
Definition: robin_hash.h:660
tsl::detail_robin_hash::robin_hash::count
size_type count(const K &key, std::size_t my_hash) const
Definition: robin_hash.h:929
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::const_iterator
robin_iterator< true > const_iterator
Definition: robin_hash.h:351
tsl::detail_robin_hash::robin_hash::swap
void swap(robin_hash &other)
Definition: robin_hash.h:864
tsl::detail_robin_hash::numeric_cast
static T numeric_cast(U value, const char *error_message="numeric_cast() failed.")
Definition: robin_hash.h:79
tsl::detail_robin_hash::robin_hash::MINIMUM_MIN_LOAD_FACTOR
static constexpr float MINIMUM_MIN_LOAD_FACTOR
Definition: robin_hash.h:1310
tsl::detail_robin_hash::robin_hash::min_load_factor
float min_load_factor() const
Definition: robin_hash.h:1002
tsl::detail_robin_hash::robin_hash::USE_STORED_HASH_ON_LOOKUP
static constexpr bool USE_STORED_HASH_ON_LOOKUP
Definition: robin_hash.h:372
tsl::detail_robin_hash::bucket_entry::clear
void clear() noexcept
Definition: robin_hash.h:218
tsl::detail_robin_hash::robin_hash::min_load_factor
void min_load_factor(float ml)
Definition: robin_hash.h:1006
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::allocator_type
std::allocator< Key > allocator_type
Definition: robin_hash.h:345
tsl::detail_robin_hash::robin_hash::max_load_factor
void max_load_factor(float ml)
Definition: robin_hash.h:1012
tsl::detail_robin_hash::robin_hash::distance_type
typename bucket_entry::distance_type distance_type
Definition: robin_hash.h:396
anonymous_namespace{Ioss_Field.C}::error_message
void error_message(const Ioss::Field &field, Ioss::Field::BasicType requested_type)
Definition: Ioss_Field.C:38
tsl::detail_robin_hash::bucket_entry::empty
bool empty() const noexcept
Definition: robin_hash.h:226
tsl::detail_robin_hash::robin_hash::find_impl
iterator find_impl(const K &key, std::size_t my_hash)
Definition: robin_hash.h:1080
tsl::detail_robin_hash::robin_hash::try_emplace_hint
iterator try_emplace_hint(const_iterator hint, K &&key, Args &&... args)
Definition: robin_hash.h:759
tsl::detail_robin_hash::robin_hash::rehash_impl
void rehash_impl(size_type new_count)
Definition: robin_hash.h:1230
tsl::detail_robin_hash::bucket_entry::bucket_entry
bucket_entry(bucket_entry &&other) noexcept(std::is_nothrow_move_constructible< value_type >::value)
Definition: robin_hash.h:184
tsl::detail_robin_hash::bucket_entry_hash::truncated_hash
truncated_hash_type truncated_hash() const noexcept
Definition: robin_hash.h:105
tsl::detail_robin_hash::bucket_entry_hash
Definition: robin_hash.h:101
tsl::detail_robin_hash::robin_hash::robin_iterator::operator->
pointer operator->() const
Definition: robin_hash.h:462
tsl::detail_robin_hash::robin_hash::at
U::value_type & at(const K &key, std::size_t my_hash)
Definition: robin_hash.h:894
tsl::detail_robin_hash::robin_hash::end
iterator end() noexcept
Definition: robin_hash.h:658
tsl::detail_robin_hash::bucket_entry::value
const value_type & value() const noexcept
Definition: robin_hash.h:237
anonymous_namespace{cth_pressure_map.C}::data
std::vector< char > data
Definition: cth_pressure_map.C:48
tsl::detail_robin_hash::robin_hash::robin_iterator::reference
value_type & reference
Definition: robin_hash.h:428
tsl::rh::power_of_two_growth_policy
Definition: robin_growth_policy.h:82
tsl::detail_robin_hash::robin_hash::robin_iterator::operator++
robin_iterator & operator++()
Definition: robin_hash.h:464
tsl::detail_robin_hash::bucket_entry::truncate_hash
static truncated_hash_type truncate_hash(std::size_t hash) noexcept
Definition: robin_hash.h:282
tsl::detail_robin_hash::robin_hash::erase
iterator erase(const_iterator first, const_iterator last)
Definition: robin_hash.h:791
tsl::detail_robin_hash::robin_hash::robin_iterator::operator=
robin_iterator & operator=(const robin_iterator &other)=default
tsl::detail_robin_hash::robin_hash::robin_iterator::robin_iterator
robin_iterator(const robin_iterator &other)=default
tsl::detail_robin_hash::robin_hash::robin_iterator::iterator_category
std::forward_iterator_tag iterator_category
Definition: robin_hash.h:425
tsl::detail_robin_hash::robin_hash::get_allocator
allocator_type get_allocator() const
Definition: robin_hash.h:631
tsl::detail_robin_hash::robin_hash::m_bucket_count
size_type m_bucket_count
Definition: robin_hash.h:1349
tsl::detail_robin_hash::robin_hash::MAXIMUM_MAX_LOAD_FACTOR
static constexpr float MAXIMUM_MAX_LOAD_FACTOR
Definition: robin_hash.h:1307
tsl::detail_robin_hash::robin_hash::max_bucket_count
size_type max_bucket_count() const
Definition: robin_hash.h:985
tsl::detail_robin_hash::bucket_entry::value
value_type & value() noexcept
Definition: robin_hash.h:231
tsl::detail_robin_hash::robin_hash::robin_iterator::m_bucket
bucket_entry_ptr m_bucket
Definition: robin_hash.h:498
tsl::detail_robin_hash::robin_hash::equal_range
std::pair< iterator, iterator > equal_range(const K &key)
Definition: robin_hash.h:956
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::reference
value_type & reference
Definition: robin_hash.h:346
tsl::detail_robin_hash::robin_hash::robin_iterator::robin_iterator
robin_iterator(robin_iterator &&other)=default
tsl::detail_robin_hash::robin_hash::operator=
robin_hash & operator=(const robin_hash &other)
Definition: robin_hash.h:600
tsl::detail_robin_hash::bucket_entry::EMPTY_MARKER_DIST_FROM_IDEAL_BUCKET
static const distance_type EMPTY_MARKER_DIST_FROM_IDEAL_BUCKET
Definition: robin_hash.h:297
tsl::detail_robin_hash::robin_hash::m_nb_elements
size_type m_nb_elements
Definition: robin_hash.h:1351
tsl::detail_robin_hash::bucket_entry
Definition: robin_hash.h:147
tsl::detail_robin_hash::robin_hash::m_try_skrink_on_next_insert
bool m_try_skrink_on_next_insert
Definition: robin_hash.h:1366
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::key_type
typename KeySelect::key_type key_type
Definition: robin_hash.h:339
tsl::detail_robin_hash::bucket_entry::destroy_value
void destroy_value() noexcept
Definition: robin_hash.h:288
tsl::detail_robin_hash::bucket_entry_hash< true >::truncated_hash
truncated_hash_type truncated_hash() const noexcept
Definition: robin_hash.h:119
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::buckets_container_type
std::vector< bucket_entry, buckets_allocator > buckets_container_type
Definition: robin_hash.h:400
tsl::detail_robin_hash::robin_hash::find
iterator find(const K &key, std::size_t my_hash)
Definition: robin_hash.h:941
tsl::detail_robin_hash::robin_hash::insert_value_on_rehash
void insert_value_on_rehash(std::size_t ibucket, distance_type dist_from_ideal_bucket, truncated_hash_type my_hash, value_type &&value)
Definition: robin_hash.h:1254
tsl::detail_robin_hash::robin_hash::bucket_count
size_type bucket_count() const
Definition: robin_hash.h:983
tsl::detail_robin_hash::robin_hash::REHASH_ON_HIGH_NB_PROBES__NPROBES
static const distance_type REHASH_ON_HIGH_NB_PROBES__NPROBES
Definition: robin_hash.h:1321
tsl::detail_robin_hash::robin_hash::insert_value_impl
void insert_value_impl(std::size_t ibucket, distance_type dist_from_ideal_bucket, truncated_hash_type my_hash, value_type &value)
Definition: robin_hash.h:1201
tsl::detail_robin_hash::bucket_entry::bucket_entry
bucket_entry(bool lst_bucket) noexcept
Definition: robin_hash.h:161
tsl::detail_robin_hash::robin_hash::try_emplace
std::pair< iterator, bool > try_emplace(K &&key, Args &&... args)
Definition: robin_hash.h:751
tsl::detail_robin_hash::bucket_entry_hash< true >::bucket_hash_equal
bool bucket_hash_equal(std::size_t hash) const noexcept
Definition: robin_hash.h:114
tsl::detail_robin_hash::robin_hash::robin_iterator::operator==
friend bool operator==(const robin_iterator &lhs, const robin_iterator &rhs)
Definition: robin_hash.h:487
tsl::detail_robin_hash::robin_hash::MAXIMUM_MIN_LOAD_FACTOR
static constexpr float MAXIMUM_MIN_LOAD_FACTOR
Definition: robin_hash.h:1311
tsl::detail_robin_hash::robin_hash::begin
iterator begin() noexcept
Definition: robin_hash.h:636
tsl::detail_robin_hash::robin_hash::erase
iterator erase(const_iterator pos)
Definition: robin_hash.h:789
tsl::detail_robin_hash::robin_hash::at
const U::value_type & at(const K &key) const
Definition: robin_hash.h:902
tsl::detail_robin_hash::robin_hash< Key, KeySelect, void, std::hash< Key >, std::equal_to< Key >, std::allocator< Key >, false, tsl::rh::power_of_two_growth_policy< 2 > >::iterator
robin_iterator< false > iterator
Definition: robin_hash.h:350
tsl::detail_robin_hash::robin_hash::robin_hash
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:575
tsl::detail_robin_hash::robin_hash::key_eq
key_equal key_eq() const
Definition: robin_hash.h:1035
tsl::detail_robin_hash::robin_hash::insert
std::pair< iterator, bool > insert(P &&value)
Definition: robin_hash.h:686
tsl::detail_robin_hash::robin_hash::load_factor
float load_factor() const
Definition: robin_hash.h:993