CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
FlatHashMap.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7#pragma once
8
9#include "Pair.hpp"
10
11#include <algorithm>
12#include <cmath>
13#include <cstddef>
14#include <cstdint>
15#include <functional>
16#include <iterator>
17#include <type_traits>
18#include <utility>
19
20namespace CeresEngine {
21
22 struct prime_number_hash_policy;
23 struct power_of_two_hash_policy;
24 struct fibonacci_hash_policy;
25
26 namespace detailv3 {
27 template<typename Result, typename Functor> struct FunctorStorage : Functor {
28 FunctorStorage() = default;
29 FunctorStorage(const Functor& functor) : Functor(functor) {}
30
31 template<typename... Args> Result operator()(Args&&... args) { return static_cast<Functor&>(*this)(std::forward<Args>(args)...); }
32
33 template<typename... Args> Result operator()(Args&&... args) const { return static_cast<const Functor&>(*this)(std::forward<Args>(args)...); }
34 };
35
36 template<typename Result, typename... Args> struct FunctorStorage<Result, Result (*)(Args...)> {
37 typedef Result (*function_ptr)(Args...);
38 function_ptr function;
39 FunctorStorage(const function_ptr function) : function(function) {}
40 Result operator()(Args... args) const { return function(std::forward<Args>(args)...); }
41 operator function_ptr&() { return function; }
42 operator const function_ptr&() { return function; }
43 };
44
45 template<typename key_type, typename value_type, typename hasher> struct KeyOrValueHasher : FunctorStorage<size_t, hasher> {
47 KeyOrValueHasher() = default;
49 size_t operator()(const key_type& key) { return static_cast<hasher_storage&>(*this)(key); }
50 size_t operator()(const key_type& key) const { return static_cast<const hasher_storage&>(*this)(key); }
51 size_t operator()(const value_type& value) { return static_cast<hasher_storage&>(*this)(value.first); }
52 size_t operator()(const value_type& value) const { return static_cast<const hasher_storage&>(*this)(value.first); }
53 template<typename F, typename S> size_t operator()(const Pair<F, S>& value) { return static_cast<hasher_storage&>(*this)(value.first); }
54 template<typename F, typename S> size_t operator()(const Pair<F, S>& value) const { return static_cast<const hasher_storage&>(*this)(value.first); }
55 };
56
57 template<typename key_type, typename value_type, typename key_equal> struct KeyOrValueEquality : FunctorStorage<bool, key_equal> {
59 KeyOrValueEquality() = default;
61 bool operator()(const key_type& lhs, const key_type& rhs) { return static_cast<equality_storage&>(*this)(lhs, rhs); }
62 bool operator()(const key_type& lhs, const value_type& rhs) { return static_cast<equality_storage&>(*this)(lhs, rhs.first); }
63 bool operator()(const value_type& lhs, const key_type& rhs) { return static_cast<equality_storage&>(*this)(lhs.first, rhs); }
64 bool operator()(const value_type& lhs, const value_type& rhs) { return static_cast<equality_storage&>(*this)(lhs.first, rhs.first); }
65 template<typename F, typename S> bool operator()(const key_type& lhs, const Pair<F, S>& rhs) {
66 return static_cast<equality_storage&>(*this)(lhs, rhs.first);
67 }
68 template<typename F, typename S> bool operator()(const Pair<F, S>& lhs, const key_type& rhs) {
69 return static_cast<equality_storage&>(*this)(lhs.first, rhs);
70 }
71 template<typename F, typename S> bool operator()(const value_type& lhs, const Pair<F, S>& rhs) {
72 return static_cast<equality_storage&>(*this)(lhs.first, rhs.first);
73 }
74 template<typename F, typename S> bool operator()(const Pair<F, S>& lhs, const value_type& rhs) {
75 return static_cast<equality_storage&>(*this)(lhs.first, rhs.first);
76 }
77 template<typename FL, typename SL, typename FR, typename SR> bool operator()(const Pair<FL, SL>& lhs, const Pair<FR, SR>& rhs) {
78 return static_cast<equality_storage&>(*this)(lhs.first, rhs.first);
79 }
80 };
81 static constexpr int8_t min_lookups = 4;
82 template<typename T> struct SherwoodV3Entry {
87 static SherwoodV3Entry result[min_lookups] = {{}, {}, {}, {special_end_value}};
88 return result;
89 }
90
91 bool has_value() const { return distance_from_desired >= 0; }
92 bool is_empty() const { return distance_from_desired < 0; }
93 bool is_at_desired_position() const { return distance_from_desired <= 0; }
94 template<typename... Args> void emplace(const int8_t distance, Args&&... args) {
95 new(std::addressof(value)) T(std::forward<Args>(args)...);
96 distance_from_desired = distance;
97 }
98
100 value.~T();
102 }
103
105 static constexpr int8_t special_end_value = 0;
106 union {
108 };
109 };
110
111 inline int8_t log2(std::uint64_t value) {
112 static constexpr int8_t table[64] = {63, 0, 58, 1, 59, 47, 53, 2, 60, 39, 48, 27, 54, 33, 42, 3, 61, 51, 37, 40, 49, 18, 28, 20, 55, 30, 34, 11, 43,
113 14, 22, 4, 62, 57, 46, 52, 38, 26, 32, 41, 50, 36, 17, 19, 29, 10, 13, 21, 56, 45, 25, 31, 35, 16, 9, 12, 44, 24, 15, 8, 23, 7, 6, 5};
114 value |= value >> 1;
115 value |= value >> 2;
116 value |= value >> 4;
117 value |= value >> 8;
118 value |= value >> 16;
119 value |= value >> 32;
120 return table[((value - (value >> 1)) * 0x07EDD5E59A4E28C2) >> 58];
121 }
122
123 template<typename T, bool> struct AssignIfTrue {
124 void operator()(T& lhs, const T& rhs) { lhs = rhs; }
125 void operator()(T& lhs, T&& rhs) { lhs = std::move(rhs); }
126 };
127 template<typename T> struct AssignIfTrue<T, false> {
128 void operator()(T&, const T&) {}
129 void operator()(T&, T&&) {}
130 };
131
132 inline size_t next_power_of_two(std::uint64_t i) {
133 --i;
134 i |= i >> 1;
135 i |= i >> 2;
136 i |= i >> 4;
137 i |= i >> 8;
138 i |= i >> 16;
139 i |= i >> 32;
140 ++i;
141 return i;
142 }
143
144 template<typename...> using void_t = void;
145
146 template<typename T, typename = void> struct HashPolicySelector { typedef fibonacci_hash_policy type; };
147
148 template<typename T> struct HashPolicySelector<T, void_t<typename T::hash_policy>> { typedef typename T::hash_policy type; };
149
150 template<typename T, typename FindKey, typename ArgumentHash, typename Hasher, typename ArgumentEqual, typename Equal, typename ArgumentAlloc, typename EntryAlloc>
151 class SherwoodV3Table : private EntryAlloc, private Hasher, private Equal {
153 using AllocatorTraits = std::allocator_traits<EntryAlloc>;
154 using EntryPointer = typename AllocatorTraits::pointer;
156
157 public:
158 using value_type = T;
160 using difference_type = std::ptrdiff_t;
163 using allocator_type = EntryAlloc;
167 using const_pointer = const value_type*;
168
172 : EntryAlloc(alloc), Hasher(hash), Equal(equal) {
174 }
178 explicit SherwoodV3Table(const ArgumentAlloc& alloc) : EntryAlloc(alloc) {}
179 template<typename It>
181 const ArgumentEqual& equal = ArgumentEqual(), const ArgumentAlloc& alloc = ArgumentAlloc())
183 insert(first, last);
184 }
185 template<typename It>
188 template<typename It>
191 SherwoodV3Table(std::initializer_list<T> il, size_type bucket_count = 0, const ArgumentHash& hash = ArgumentHash(),
192 const ArgumentEqual& equal = ArgumentEqual(), const ArgumentAlloc& alloc = ArgumentAlloc())
194 if(bucket_count == 0)
195 rehash(il.size());
196 insert(il.begin(), il.end());
197 }
205 : EntryAlloc(alloc), Hasher(other), Equal(other), _max_load_factor(other._max_load_factor) {
207 try {
208 insert(other.begin(), other.end());
209 } catch(...) {
210 clear();
212 throw;
213 }
214 }
215 SherwoodV3Table(SherwoodV3Table&& other) noexcept : EntryAlloc(std::move(other)), Hasher(std::move(other)), Equal(std::move(other)) {
216 swap_pointers(other);
217 }
219 : EntryAlloc(alloc), Hasher(std::move(other)), Equal(std::move(other)) {
220 swap_pointers(other);
221 }
223 if(this == std::addressof(other))
224 return *this;
225
226 clear();
227 if(AllocatorTraits::propagate_on_container_copy_assignment::value) {
228 if(static_cast<EntryAlloc&>(*this) != static_cast<const EntryAlloc&>(other)) {
230 }
232 }
234 static_cast<Hasher&>(*this) = other;
235 static_cast<Equal&>(*this) = other;
237 insert(other.begin(), other.end());
238 return *this;
239 }
241 if(this == std::addressof(other))
242 return *this;
243 else if(AllocatorTraits::propagate_on_container_move_assignment::value) {
244 clear();
247 swap_pointers(other);
248 } else if(static_cast<EntryAlloc&>(*this) == static_cast<EntryAlloc&>(other)) {
249 swap_pointers(other);
250 } else {
251 clear();
252 _max_load_factor = other._max_load_factor;
254 for(T& elem : other)
255 emplace(std::move(elem));
256 other.clear();
257 }
258 static_cast<Hasher&>(*this) = std::move(other);
259 static_cast<Equal&>(*this) = std::move(other);
260 return *this;
261 }
266
267 const allocator_type& get_allocator() const { return static_cast<const allocator_type&>(*this); }
268 const ArgumentEqual& key_eq() const { return static_cast<const ArgumentEqual&>(*this); }
269 const ArgumentHash& hash_function() const { return static_cast<const ArgumentHash&>(*this); }
270
271 template<typename ValueType> struct templated_iterator {
275
276 using iterator_category = std::forward_iterator_tag;
277 using value_type = ValueType;
279 using pointer = ValueType*;
280 using reference = ValueType&;
281
282 friend bool operator==(const templated_iterator& lhs, const templated_iterator& rhs) { return lhs.current == rhs.current; }
283 friend bool operator!=(const templated_iterator& lhs, const templated_iterator& rhs) { return !(lhs == rhs); }
284
286 do {
287 ++current;
288 } while(current->is_empty());
289 return *this;
290 }
293 ++*this;
294 return copy;
295 }
296
297 ValueType& operator*() const { return current->value; }
298 ValueType* operator->() const { return std::addressof(current->value); }
299
300 operator templated_iterator<const value_type>() const { return {current}; }
301 };
304
306 for(EntryPointer it = entries;; ++it) {
307 if(it->has_value())
308 return {it};
309 }
310 }
312 for(EntryPointer it = entries;; ++it) {
313 if(it->has_value())
314 return {it};
315 }
316 }
317 const_iterator cbegin() const { return begin(); }
319 const_iterator end() const { return {entries + static_cast<ptrdiff_t>(num_slots_minus_one + max_lookups)}; }
320 const_iterator cend() const { return end(); }
321
323 const size_t index = hash_policy.index_for_hash(hash_object(key), num_slots_minus_one);
324 EntryPointer it = entries + ptrdiff_t(index);
325 for(int8_t distance = 0; it->distance_from_desired >= distance; ++distance, ++it) {
326 if(compares_equal(key, it->value))
327 return {it};
328 }
329 return end();
330 }
331 const_iterator find(const FindKey& key) const { return const_cast<SherwoodV3Table*>(this)->find(key); }
332 size_t count(const FindKey& key) const { return find(key) == end() ? 0 : 1; }
335 if(found == end())
336 return {found, found};
337 else
338 return {found, std::next(found)};
339 }
342 if(found == end())
343 return {found, found};
344 else
345 return {found, std::next(found)};
346 }
347
348 template<typename Key, typename... Args> Pair<iterator, bool> emplace(Key&& key, Args&&... args) {
349 const size_t index = hash_policy.index_for_hash(hash_object(key), num_slots_minus_one);
351 int8_t distance_from_desired = 0;
352 for(; current_entry->distance_from_desired >= distance_from_desired; ++current_entry, ++distance_from_desired) {
353 if(compares_equal(key, current_entry->value))
354 return {{current_entry}, false};
355 }
356 return emplace_new_key(distance_from_desired, current_entry, std::forward<Key>(key), std::forward<Args>(args)...);
357 }
358
359 Pair<iterator, bool> insert(const value_type& value) { return emplace(value); }
360 Pair<iterator, bool> insert(value_type&& value) { return emplace(std::move(value)); }
361 template<typename... Args> iterator emplace_hint(const_iterator, Args&&... args) { return emplace(std::forward<Args>(args)...).first; }
362 iterator insert(const_iterator, const value_type& value) { return emplace(value).first; }
363 iterator insert(const_iterator, value_type&& value) { return emplace(std::move(value)).first; }
364
365 template<typename It> void insert(It begin, It end) {
366 for(; begin != end; ++begin) {
367 emplace(*begin);
368 }
369 }
370 void insert(std::initializer_list<value_type> il) { insert(il.begin(), il.end()); }
371
372 void rehash(size_t num_buckets) {
373 num_buckets = std::max(num_buckets, static_cast<size_t>(std::ceil(num_elements / static_cast<double>(_max_load_factor))));
374 if(num_buckets == 0) {
376 return;
377 }
378 auto new_prime_index = hash_policy.next_size_over(num_buckets);
380 return;
382 EntryPointer new_buckets(AllocatorTraits::allocate(*this, num_buckets + new_max_lookups));
384 for(EntryPointer it = new_buckets; it != special_end_item; ++it)
385 it->distance_from_desired = -1;
386 special_end_item->distance_from_desired = Entry::special_end_value;
387 std::swap(entries, new_buckets);
393 num_elements = 0;
394 for(EntryPointer it = new_buckets, end = it + static_cast<ptrdiff_t>(num_buckets + old_max_lookups); it != end; ++it) {
395 if(it->has_value()) {
396 emplace(std::move(it->value));
397 it->destroy_value();
398 }
399 }
401 }
402
408
409 // the return value is a type that can be converted to an iterator
410 // the reason for doing this is that it's not free to find the
411 // iterator pointing at the next element. if you care about the
412 // next iterator, turn the return value into an iterator
414 EntryPointer current = to_erase.current;
415 current->destroy_value();
416 --num_elements;
417 for(EntryPointer next = current + ptrdiff_t(1); !next->is_at_desired_position(); ++current, ++next) {
418 current->emplace(next->distance_from_desired - 1, std::move(next->value));
419 next->destroy_value();
420 }
421 return {to_erase.current};
422 }
423
425 if(begin_it == end_it)
426 return {begin_it.current};
427 for(EntryPointer it = begin_it.current, end = end_it.current; it != end; ++it) {
428 if(it->has_value()) {
429 it->destroy_value();
430 --num_elements;
431 }
432 }
433 if(end_it == this->end())
434 return this->end();
435 ptrdiff_t num_to_move = std::min(static_cast<ptrdiff_t>(end_it.current->distance_from_desired), end_it.current - begin_it.current);
437 for(EntryPointer it = end_it.current; !it->is_at_desired_position();) {
438 EntryPointer target = it - num_to_move;
439 target->emplace(it->distance_from_desired - num_to_move, std::move(it->value));
440 it->destroy_value();
441 ++it;
442 num_to_move = std::min(static_cast<ptrdiff_t>(it->distance_from_desired), num_to_move);
443 }
444 return {to_return};
445 }
446
447 size_t erase(const FindKey& key) {
448 auto found = find(key);
449 if(found == end())
450 return 0;
451 else {
452 erase(found);
453 return 1;
454 }
455 }
456
457 void clear() {
458 for(EntryPointer it = entries, end = it + static_cast<ptrdiff_t>(num_slots_minus_one + max_lookups); it != end; ++it) {
459 if(it->has_value())
460 it->destroy_value();
461 }
462 num_elements = 0;
463 }
464
466
467 void swap(SherwoodV3Table& other) {
468 using std::swap;
469 swap_pointers(other);
470 swap(static_cast<ArgumentHash&>(*this), static_cast<ArgumentHash&>(other));
471 swap(static_cast<ArgumentEqual&>(*this), static_cast<ArgumentEqual&>(other));
472 if(AllocatorTraits::propagate_on_container_swap::value)
473 swap(static_cast<EntryAlloc&>(*this), static_cast<EntryAlloc&>(other));
474 }
475
476 size_t size() const { return num_elements; }
477 size_t max_size() const { return (AllocatorTraits::max_size(*this)) / sizeof(Entry); }
478 size_t bucket_count() const { return num_slots_minus_one ? num_slots_minus_one + 1 : 0; }
479 size_type max_bucket_count() const { return (AllocatorTraits::max_size(*this) - min_lookups) / sizeof(Entry); }
480 size_t bucket(const FindKey& key) const { return hash_policy.index_for_hash(hash_object(key), num_slots_minus_one); }
481 float load_factor() const {
482 const size_t buckets = bucket_count();
483 if(buckets)
484 return static_cast<float>(num_elements) / bucket_count();
485 else
486 return 0;
487 }
488 void max_load_factor(const float value) { _max_load_factor = value; }
489 float max_load_factor() const { return _max_load_factor; }
490
491 bool empty() const { return num_elements == 0; }
492
493 private:
497 int8_t max_lookups = detailv3::min_lookups - 1;
498 float _max_load_factor = 0.5f;
499 size_t num_elements = 0;
500
503 return std::max(detailv3::min_lookups, desired);
504 }
505
506 size_t num_buckets_for_reserve(const size_t num_elements) const {
507 return static_cast<size_t>(std::ceil(num_elements / std::min(0.5, static_cast<double>(_max_load_factor))));
508 }
510
512 using std::swap;
514 swap(entries, other.entries);
519 }
520
521 template<typename Key, typename... Args>
522 Pair<iterator, bool> emplace_new_key(int8_t distance_from_desired, EntryPointer current_entry, Key&& key, Args&&... args) {
523 using std::swap;
524 if(num_slots_minus_one == 0 || distance_from_desired == max_lookups ||
525 num_elements + 1 > (num_slots_minus_one + 1) * static_cast<double>(_max_load_factor)) {
526 grow();
527 return emplace(std::forward<Key>(key), std::forward<Args>(args)...);
528 } else if(current_entry->is_empty()) {
529 current_entry->emplace(distance_from_desired, std::forward<Key>(key), std::forward<Args>(args)...);
530 ++num_elements;
531 return {{current_entry}, true};
532 }
533 value_type to_insert(std::forward<Key>(key), std::forward<Args>(args)...);
534 swap(distance_from_desired, current_entry->distance_from_desired);
537 for(++distance_from_desired, ++current_entry;; ++current_entry) {
538 if(current_entry->is_empty()) {
539 current_entry->emplace(distance_from_desired, std::move(to_insert));
540 ++num_elements;
541 return {result, true};
542 } else if(current_entry->distance_from_desired < distance_from_desired) {
543 swap(distance_from_desired, current_entry->distance_from_desired);
545 ++distance_from_desired;
546 } else {
547 ++distance_from_desired;
548 if(distance_from_desired == max_lookups) {
549 swap(to_insert, result.current->value);
550 grow();
551 return emplace(std::move(to_insert));
552 }
553 }
554 }
555 }
556
557 void grow() { rehash(std::max(size_t(4), 2 * bucket_count())); }
558
561 AllocatorTraits::deallocate(*this, begin, num_slots_minus_one + max_lookups + 1);
562 }
563 }
564
572
573 template<typename U> size_t hash_object(const U& key) { return static_cast<Hasher&>(*this)(key); }
574 template<typename U> size_t hash_object(const U& key) const { return static_cast<const Hasher&>(*this)(key); }
575 template<typename L, typename R> bool compares_equal(const L& lhs, const R& rhs) { return static_cast<Equal&>(*this)(lhs, rhs); }
576
579
580 operator iterator() {
581 if(it->has_value())
582 return {it};
583 else
584 return ++iterator{it};
585 }
586 operator const_iterator() {
587 if(it->has_value())
588 return {it};
589 else
590 return ++const_iterator{it};
591 }
592 };
593 };
594 } // namespace detailv3
595
597 static size_t mod0(size_t) { return 0llu; }
598 static size_t mod2(const size_t hash) { return hash % 2llu; }
599 static size_t mod3(const size_t hash) { return hash % 3llu; }
600 static size_t mod5(const size_t hash) { return hash % 5llu; }
601 static size_t mod7(const size_t hash) { return hash % 7llu; }
602 static size_t mod11(const size_t hash) { return hash % 11llu; }
603 static size_t mod13(const size_t hash) { return hash % 13llu; }
604 static size_t mod17(const size_t hash) { return hash % 17llu; }
605 static size_t mod23(const size_t hash) { return hash % 23llu; }
606 static size_t mod29(const size_t hash) { return hash % 29llu; }
607 static size_t mod37(const size_t hash) { return hash % 37llu; }
608 static size_t mod47(const size_t hash) { return hash % 47llu; }
609 static size_t mod59(const size_t hash) { return hash % 59llu; }
610 static size_t mod73(const size_t hash) { return hash % 73llu; }
611 static size_t mod97(const size_t hash) { return hash % 97llu; }
612 static size_t mod127(const size_t hash) { return hash % 127llu; }
613 static size_t mod151(const size_t hash) { return hash % 151llu; }
614 static size_t mod197(const size_t hash) { return hash % 197llu; }
615 static size_t mod251(const size_t hash) { return hash % 251llu; }
616 static size_t mod313(const size_t hash) { return hash % 313llu; }
617 static size_t mod397(const size_t hash) { return hash % 397llu; }
618 static size_t mod499(const size_t hash) { return hash % 499llu; }
619 static size_t mod631(const size_t hash) { return hash % 631llu; }
620 static size_t mod797(const size_t hash) { return hash % 797llu; }
621 static size_t mod1009(const size_t hash) { return hash % 1009llu; }
622 static size_t mod1259(const size_t hash) { return hash % 1259llu; }
623 static size_t mod1597(const size_t hash) { return hash % 1597llu; }
624 static size_t mod2011(const size_t hash) { return hash % 2011llu; }
625 static size_t mod2539(const size_t hash) { return hash % 2539llu; }
626 static size_t mod3203(const size_t hash) { return hash % 3203llu; }
627 static size_t mod4027(const size_t hash) { return hash % 4027llu; }
628 static size_t mod5087(const size_t hash) { return hash % 5087llu; }
629 static size_t mod6421(const size_t hash) { return hash % 6421llu; }
630 static size_t mod8089(const size_t hash) { return hash % 8089llu; }
631 static size_t mod10193(const size_t hash) { return hash % 10193llu; }
632 static size_t mod12853(const size_t hash) { return hash % 12853llu; }
633 static size_t mod16193(const size_t hash) { return hash % 16193llu; }
634 static size_t mod20399(const size_t hash) { return hash % 20399llu; }
635 static size_t mod25717(const size_t hash) { return hash % 25717llu; }
636 static size_t mod32401(const size_t hash) { return hash % 32401llu; }
637 static size_t mod40823(const size_t hash) { return hash % 40823llu; }
638 static size_t mod51437(const size_t hash) { return hash % 51437llu; }
639 static size_t mod64811(const size_t hash) { return hash % 64811llu; }
640 static size_t mod81649(const size_t hash) { return hash % 81649llu; }
641 static size_t mod102877(const size_t hash) { return hash % 102877llu; }
642 static size_t mod129607(const size_t hash) { return hash % 129607llu; }
643 static size_t mod163307(const size_t hash) { return hash % 163307llu; }
644 static size_t mod205759(const size_t hash) { return hash % 205759llu; }
645 static size_t mod259229(const size_t hash) { return hash % 259229llu; }
646 static size_t mod326617(const size_t hash) { return hash % 326617llu; }
647 static size_t mod411527(const size_t hash) { return hash % 411527llu; }
648 static size_t mod518509(const size_t hash) { return hash % 518509llu; }
649 static size_t mod653267(const size_t hash) { return hash % 653267llu; }
650 static size_t mod823117(const size_t hash) { return hash % 823117llu; }
651 static size_t mod1037059(const size_t hash) { return hash % 1037059llu; }
652 static size_t mod1306601(const size_t hash) { return hash % 1306601llu; }
653 static size_t mod1646237(const size_t hash) { return hash % 1646237llu; }
654 static size_t mod2074129(const size_t hash) { return hash % 2074129llu; }
655 static size_t mod2613229(const size_t hash) { return hash % 2613229llu; }
656 static size_t mod3292489(const size_t hash) { return hash % 3292489llu; }
657 static size_t mod4148279(const size_t hash) { return hash % 4148279llu; }
658 static size_t mod5226491(const size_t hash) { return hash % 5226491llu; }
659 static size_t mod6584983(const size_t hash) { return hash % 6584983llu; }
660 static size_t mod8296553(const size_t hash) { return hash % 8296553llu; }
661 static size_t mod10453007(const size_t hash) { return hash % 10453007llu; }
662 static size_t mod13169977(const size_t hash) { return hash % 13169977llu; }
663 static size_t mod16593127(const size_t hash) { return hash % 16593127llu; }
664 static size_t mod20906033(const size_t hash) { return hash % 20906033llu; }
665 static size_t mod26339969(const size_t hash) { return hash % 26339969llu; }
666 static size_t mod33186281(const size_t hash) { return hash % 33186281llu; }
667 static size_t mod41812097(const size_t hash) { return hash % 41812097llu; }
668 static size_t mod52679969(const size_t hash) { return hash % 52679969llu; }
669 static size_t mod66372617(const size_t hash) { return hash % 66372617llu; }
670 static size_t mod83624237(const size_t hash) { return hash % 83624237llu; }
671 static size_t mod105359939(const size_t hash) { return hash % 105359939llu; }
672 static size_t mod132745199(const size_t hash) { return hash % 132745199llu; }
673 static size_t mod167248483(const size_t hash) { return hash % 167248483llu; }
674 static size_t mod210719881(const size_t hash) { return hash % 210719881llu; }
675 static size_t mod265490441(const size_t hash) { return hash % 265490441llu; }
676 static size_t mod334496971(const size_t hash) { return hash % 334496971llu; }
677 static size_t mod421439783(const size_t hash) { return hash % 421439783llu; }
678 static size_t mod530980861(const size_t hash) { return hash % 530980861llu; }
679 static size_t mod668993977(const size_t hash) { return hash % 668993977llu; }
680 static size_t mod842879579(const size_t hash) { return hash % 842879579llu; }
681 static size_t mod1061961721(const size_t hash) { return hash % 1061961721llu; }
682 static size_t mod1337987929(const size_t hash) { return hash % 1337987929llu; }
683 static size_t mod1685759167(const size_t hash) { return hash % 1685759167llu; }
684 static size_t mod2123923447(const size_t hash) { return hash % 2123923447llu; }
685 static size_t mod2675975881(const size_t hash) { return hash % 2675975881llu; }
686 static size_t mod3371518343(const size_t hash) { return hash % 3371518343llu; }
687 static size_t mod4247846927(const size_t hash) { return hash % 4247846927llu; }
688 static size_t mod5351951779(const size_t hash) { return hash % 5351951779llu; }
689 static size_t mod6743036717(const size_t hash) { return hash % 6743036717llu; }
690 static size_t mod8495693897(const size_t hash) { return hash % 8495693897llu; }
691 static size_t mod10703903591(const size_t hash) { return hash % 10703903591llu; }
692 static size_t mod13486073473(const size_t hash) { return hash % 13486073473llu; }
693 static size_t mod16991387857(const size_t hash) { return hash % 16991387857llu; }
694 static size_t mod21407807219(const size_t hash) { return hash % 21407807219llu; }
695 static size_t mod26972146961(const size_t hash) { return hash % 26972146961llu; }
696 static size_t mod33982775741(const size_t hash) { return hash % 33982775741llu; }
697 static size_t mod42815614441(const size_t hash) { return hash % 42815614441llu; }
698 static size_t mod53944293929(const size_t hash) { return hash % 53944293929llu; }
699 static size_t mod67965551447(const size_t hash) { return hash % 67965551447llu; }
700 static size_t mod85631228929(const size_t hash) { return hash % 85631228929llu; }
701 static size_t mod107888587883(const size_t hash) { return hash % 107888587883llu; }
702 static size_t mod135931102921(const size_t hash) { return hash % 135931102921llu; }
703 static size_t mod171262457903(const size_t hash) { return hash % 171262457903llu; }
704 static size_t mod215777175787(const size_t hash) { return hash % 215777175787llu; }
705 static size_t mod271862205833(const size_t hash) { return hash % 271862205833llu; }
706 static size_t mod342524915839(const size_t hash) { return hash % 342524915839llu; }
707 static size_t mod431554351609(const size_t hash) { return hash % 431554351609llu; }
708 static size_t mod543724411781(const size_t hash) { return hash % 543724411781llu; }
709 static size_t mod685049831731(const size_t hash) { return hash % 685049831731llu; }
710 static size_t mod863108703229(const size_t hash) { return hash % 863108703229llu; }
711 static size_t mod1087448823553(const size_t hash) { return hash % 1087448823553llu; }
712 static size_t mod1370099663459(const size_t hash) { return hash % 1370099663459llu; }
713 static size_t mod1726217406467(const size_t hash) { return hash % 1726217406467llu; }
714 static size_t mod2174897647073(const size_t hash) { return hash % 2174897647073llu; }
715 static size_t mod2740199326961(const size_t hash) { return hash % 2740199326961llu; }
716 static size_t mod3452434812973(const size_t hash) { return hash % 3452434812973llu; }
717 static size_t mod4349795294267(const size_t hash) { return hash % 4349795294267llu; }
718 static size_t mod5480398654009(const size_t hash) { return hash % 5480398654009llu; }
719 static size_t mod6904869625999(const size_t hash) { return hash % 6904869625999llu; }
720 static size_t mod8699590588571(const size_t hash) { return hash % 8699590588571llu; }
721 static size_t mod10960797308051(const size_t hash) { return hash % 10960797308051llu; }
722 static size_t mod13809739252051(const size_t hash) { return hash % 13809739252051llu; }
723 static size_t mod17399181177241(const size_t hash) { return hash % 17399181177241llu; }
724 static size_t mod21921594616111(const size_t hash) { return hash % 21921594616111llu; }
725 static size_t mod27619478504183(const size_t hash) { return hash % 27619478504183llu; }
726 static size_t mod34798362354533(const size_t hash) { return hash % 34798362354533llu; }
727 static size_t mod43843189232363(const size_t hash) { return hash % 43843189232363llu; }
728 static size_t mod55238957008387(const size_t hash) { return hash % 55238957008387llu; }
729 static size_t mod69596724709081(const size_t hash) { return hash % 69596724709081llu; }
730 static size_t mod87686378464759(const size_t hash) { return hash % 87686378464759llu; }
731 static size_t mod110477914016779(const size_t hash) { return hash % 110477914016779llu; }
732 static size_t mod139193449418173(const size_t hash) { return hash % 139193449418173llu; }
733 static size_t mod175372756929481(const size_t hash) { return hash % 175372756929481llu; }
734 static size_t mod220955828033581(const size_t hash) { return hash % 220955828033581llu; }
735 static size_t mod278386898836457(const size_t hash) { return hash % 278386898836457llu; }
736 static size_t mod350745513859007(const size_t hash) { return hash % 350745513859007llu; }
737 static size_t mod441911656067171(const size_t hash) { return hash % 441911656067171llu; }
738 static size_t mod556773797672909(const size_t hash) { return hash % 556773797672909llu; }
739 static size_t mod701491027718027(const size_t hash) { return hash % 701491027718027llu; }
740 static size_t mod883823312134381(const size_t hash) { return hash % 883823312134381llu; }
741 static size_t mod1113547595345903(const size_t hash) { return hash % 1113547595345903llu; }
742 static size_t mod1402982055436147(const size_t hash) { return hash % 1402982055436147llu; }
743 static size_t mod1767646624268779(const size_t hash) { return hash % 1767646624268779llu; }
744 static size_t mod2227095190691797(const size_t hash) { return hash % 2227095190691797llu; }
745 static size_t mod2805964110872297(const size_t hash) { return hash % 2805964110872297llu; }
746 static size_t mod3535293248537579(const size_t hash) { return hash % 3535293248537579llu; }
747 static size_t mod4454190381383713(const size_t hash) { return hash % 4454190381383713llu; }
748 static size_t mod5611928221744609(const size_t hash) { return hash % 5611928221744609llu; }
749 static size_t mod7070586497075177(const size_t hash) { return hash % 7070586497075177llu; }
750 static size_t mod8908380762767489(const size_t hash) { return hash % 8908380762767489llu; }
751 static size_t mod11223856443489329(const size_t hash) { return hash % 11223856443489329llu; }
752 static size_t mod14141172994150357(const size_t hash) { return hash % 14141172994150357llu; }
753 static size_t mod17816761525534927(const size_t hash) { return hash % 17816761525534927llu; }
754 static size_t mod22447712886978529(const size_t hash) { return hash % 22447712886978529llu; }
755 static size_t mod28282345988300791(const size_t hash) { return hash % 28282345988300791llu; }
756 static size_t mod35633523051069991(const size_t hash) { return hash % 35633523051069991llu; }
757 static size_t mod44895425773957261(const size_t hash) { return hash % 44895425773957261llu; }
758 static size_t mod56564691976601587(const size_t hash) { return hash % 56564691976601587llu; }
759 static size_t mod71267046102139967(const size_t hash) { return hash % 71267046102139967llu; }
760 static size_t mod89790851547914507(const size_t hash) { return hash % 89790851547914507llu; }
761 static size_t mod113129383953203213(const size_t hash) { return hash % 113129383953203213llu; }
762 static size_t mod142534092204280003(const size_t hash) { return hash % 142534092204280003llu; }
763 static size_t mod179581703095829107(const size_t hash) { return hash % 179581703095829107llu; }
764 static size_t mod226258767906406483(const size_t hash) { return hash % 226258767906406483llu; }
765 static size_t mod285068184408560057(const size_t hash) { return hash % 285068184408560057llu; }
766 static size_t mod359163406191658253(const size_t hash) { return hash % 359163406191658253llu; }
767 static size_t mod452517535812813007(const size_t hash) { return hash % 452517535812813007llu; }
768 static size_t mod570136368817120201(const size_t hash) { return hash % 570136368817120201llu; }
769 static size_t mod718326812383316683(const size_t hash) { return hash % 718326812383316683llu; }
770 static size_t mod905035071625626043(const size_t hash) { return hash % 905035071625626043llu; }
771 static size_t mod1140272737634240411(const size_t hash) { return hash % 1140272737634240411llu; }
772 static size_t mod1436653624766633509(const size_t hash) { return hash % 1436653624766633509llu; }
773 static size_t mod1810070143251252131(const size_t hash) { return hash % 1810070143251252131llu; }
774 static size_t mod2280545475268481167(const size_t hash) { return hash % 2280545475268481167llu; }
775 static size_t mod2873307249533267101(const size_t hash) { return hash % 2873307249533267101llu; }
776 static size_t mod3620140286502504283(const size_t hash) { return hash % 3620140286502504283llu; }
777 static size_t mod4561090950536962147(const size_t hash) { return hash % 4561090950536962147llu; }
778 static size_t mod5746614499066534157(const size_t hash) { return hash % 5746614499066534157llu; }
779 static size_t mod7240280573005008577(const size_t hash) { return hash % 7240280573005008577llu; }
780 static size_t mod9122181901073924329(const size_t hash) { return hash % 9122181901073924329llu; }
781 static size_t mod11493228998133068689(const size_t hash) { return hash % 11493228998133068689llu; }
782 static size_t mod14480561146010017169(const size_t hash) { return hash % 14480561146010017169llu; }
783 static size_t mod18446744073709551557(const size_t hash) { return hash % 18446744073709551557llu; }
784
786
787 mod_function next_size_over(size_t& size) const {
788 // prime numbers generated by the following method:
789 // 1. start with a prime p = 2
790 // 2. go to wolfram alpha and get p = NextPrime(2 * p)
791 // 3. repeat 2. until you overflow 64 bits
792 // you now have large gaps which you would hit if somebody called reserve() with an unlucky number.
793 // 4. to fill the gaps for every prime p go to wolfram alpha and get ClosestPrime(p * 2^(1/3)) and ClosestPrime(p * 2^(2/3)) and put those in the gaps
794 // 5. get PrevPrime(2^64) and put it at the end
795 static constexpr const std::uint64_t prime_list[] = {2llu, 3llu, 5llu, 7llu, 11llu, 13llu, 17llu, 23llu, 29llu, 37llu, 47llu, 59llu, 73llu, 97llu,
796 127llu, 151llu, 197llu, 251llu, 313llu, 397llu, 499llu, 631llu, 797llu, 1009llu, 1259llu, 1597llu, 2011llu, 2539llu, 3203llu, 4027llu, 5087llu,
797 6421llu, 8089llu, 10193llu, 12853llu, 16193llu, 20399llu, 25717llu, 32401llu, 40823llu, 51437llu, 64811llu, 81649llu, 102877llu, 129607llu,
798 163307llu, 205759llu, 259229llu, 326617llu, 411527llu, 518509llu, 653267llu, 823117llu, 1037059llu, 1306601llu, 1646237llu, 2074129llu,
799 2613229llu, 3292489llu, 4148279llu, 5226491llu, 6584983llu, 8296553llu, 10453007llu, 13169977llu, 16593127llu, 20906033llu, 26339969llu,
800 33186281llu, 41812097llu, 52679969llu, 66372617llu, 83624237llu, 105359939llu, 132745199llu, 167248483llu, 210719881llu, 265490441llu,
801 334496971llu, 421439783llu, 530980861llu, 668993977llu, 842879579llu, 1061961721llu, 1337987929llu, 1685759167llu, 2123923447llu, 2675975881llu,
802 3371518343llu, 4247846927llu, 5351951779llu, 6743036717llu, 8495693897llu, 10703903591llu, 13486073473llu, 16991387857llu, 21407807219llu,
803 26972146961llu, 33982775741llu, 42815614441llu, 53944293929llu, 67965551447llu, 85631228929llu, 107888587883llu, 135931102921llu,
804 171262457903llu, 215777175787llu, 271862205833llu, 342524915839llu, 431554351609llu, 543724411781llu, 685049831731llu, 863108703229llu,
805 1087448823553llu, 1370099663459llu, 1726217406467llu, 2174897647073llu, 2740199326961llu, 3452434812973llu, 4349795294267llu, 5480398654009llu,
806 6904869625999llu, 8699590588571llu, 10960797308051llu, 13809739252051llu, 17399181177241llu, 21921594616111llu, 27619478504183llu,
807 34798362354533llu, 43843189232363llu, 55238957008387llu, 69596724709081llu, 87686378464759llu, 110477914016779llu, 139193449418173llu,
808 175372756929481llu, 220955828033581llu, 278386898836457llu, 350745513859007llu, 441911656067171llu, 556773797672909llu, 701491027718027llu,
809 883823312134381llu, 1113547595345903llu, 1402982055436147llu, 1767646624268779llu, 2227095190691797llu, 2805964110872297llu,
810 3535293248537579llu, 4454190381383713llu, 5611928221744609llu, 7070586497075177llu, 8908380762767489llu, 11223856443489329llu,
811 14141172994150357llu, 17816761525534927llu, 22447712886978529llu, 28282345988300791llu, 35633523051069991llu, 44895425773957261llu,
812 56564691976601587llu, 71267046102139967llu, 89790851547914507llu, 113129383953203213llu, 142534092204280003llu, 179581703095829107llu,
813 226258767906406483llu, 285068184408560057llu, 359163406191658253llu, 452517535812813007llu, 570136368817120201llu, 718326812383316683llu,
814 905035071625626043llu, 1140272737634240411llu, 1436653624766633509llu, 1810070143251252131llu, 2280545475268481167llu, 2873307249533267101llu,
815 3620140286502504283llu, 4561090950536962147llu, 5746614499066534157llu, 7240280573005008577llu, 9122181901073924329llu, 11493228998133068689llu,
816 14480561146010017169llu, 18446744073709551557llu};
817 static constexpr size_t (*const mod_functions[])(size_t) = {&mod0, &mod2, &mod3, &mod5, &mod7, &mod11, &mod13, &mod17, &mod23, &mod29, &mod37,
840 const std::uint64_t* found = std::lower_bound(std::begin(prime_list), std::end(prime_list) - 1, size);
841 size = *found;
842 return mod_functions[1 + found - prime_list];
843 }
846
847 size_t index_for_hash(const size_t hash, size_t /*num_slots_minus_one*/) const { return current_mod_function(hash); }
848 size_t keep_in_range(const size_t index, const size_t num_slots_minus_one) const { return index > num_slots_minus_one ? current_mod_function(index) : index; }
849
850 private:
852 };
853
855 size_t index_for_hash(const size_t hash, const size_t num_slots_minus_one) const { return hash & num_slots_minus_one; }
856 size_t keep_in_range(const size_t index, const size_t num_slots_minus_one) const { return index_for_hash(index, num_slots_minus_one); }
857 int8_t next_size_over(size_t& size) const {
858 size = detailv3::next_power_of_two(size);
859 return 0;
860 }
861 void commit(int8_t) {}
862 void reset() {}
863 };
864
866 size_t index_for_hash(const size_t hash, size_t /*num_slots_minus_one*/) const { return (11400714819323198485ull * hash) >> shift; }
867 size_t keep_in_range(const size_t index, const size_t num_slots_minus_one) const { return index & num_slots_minus_one; }
868
869 int8_t next_size_over(size_t& size) const {
870 size = std::max(size_t(2), detailv3::next_power_of_two(size));
871 return 64 - detailv3::log2(size);
872 }
873 void commit(const int8_t shift) { this->shift = shift; }
874 void reset() { shift = 63; }
875
876 private:
878 };
879
880 template<typename K, typename V, typename H = std::hash<K>, typename E = std::equal_to<>, typename A = std::allocator<Pair<K, V>>>
882 : public detailv3::SherwoodV3Table<Pair<K, V>, K, H, detailv3::KeyOrValueHasher<K, Pair<K, V>, H>, E, detailv3::KeyOrValueEquality<K, Pair<K, V>, E>,
883 A, typename std::allocator_traits<A>::template rebind_alloc<detailv3::SherwoodV3Entry<Pair<K, V>>>> {
886
887 public:
888 using key_type = K;
889 using mapped_type = V;
890
891 using Table::Table;
893
894 inline V& operator[](const K& key) { return emplace(key, convertible_to_value()).first->second; }
895 inline V& operator[](K&& key) { return emplace(std::move(key), convertible_to_value()).first->second; }
896 V& at(const K& key) {
897 auto found = this->find(key);
898 if(found == this->end())
899 throw std::out_of_range("Argument passed to at() was not in the map.");
900 return found->second;
901 }
902 const V& at(const K& key) const {
903 auto found = this->find(key);
904 if(found == this->end())
905 throw std::out_of_range("Argument passed to at() was not in the map.");
906 return found->second;
907 }
908
909 using Table::emplace;
912 auto emplace_result = emplace(key, std::forward<M>(m));
913 if(!emplace_result.second)
914 emplace_result.first->second = std::forward<M>(m);
915 return emplace_result;
916 }
918 auto emplace_result = emplace(std::move(key), std::forward<M>(m));
919 if(!emplace_result.second)
920 emplace_result.first->second = std::forward<M>(m);
921 return emplace_result;
922 }
923 template<typename M> typename Table::iterator insert_or_assign(typename Table::const_iterator, const key_type& key, M&& m) {
924 return insert_or_assign(key, std::forward<M>(m)).first;
925 }
926 template<typename M> typename Table::iterator insert_or_assign(typename Table::const_iterator, key_type&& key, M&& m) {
927 return insert_or_assign(std::move(key), std::forward<M>(m)).first;
928 }
929
930 friend bool operator==(const FlatHashMap& lhs, const FlatHashMap& rhs) {
931 if(lhs.size() != rhs.size())
932 return false;
933 for(const typename Table::value_type& value : lhs) {
934 auto found = rhs.find(value.first);
935 if(found == rhs.end())
936 return false;
937 else if(value.second != found->second)
938 return false;
939 }
940 return true;
941 }
942 friend bool operator!=(const FlatHashMap& lhs, const FlatHashMap& rhs) { return !(lhs == rhs); }
943
944 private:
946 operator V() const { return V(); }
947 };
948 };
949
950 template<typename T, typename H = std::hash<T>, typename E = std::equal_to<>, typename A = std::allocator<T>>
951 class FlatHashSet : public detailv3::SherwoodV3Table<T, T, H, detailv3::FunctorStorage<size_t, H>, E, detailv3::FunctorStorage<bool, E>, A,
952 typename std::allocator_traits<A>::template rebind_alloc<detailv3::SherwoodV3Entry<T>>> {
954 typename std::allocator_traits<A>::template rebind_alloc<detailv3::SherwoodV3Entry<T>>>;
955
956 public:
957 using key_type = T;
958
959 using Table::Table;
961
962 template<typename... Args> Pair<typename Table::iterator, bool> emplace(Args&&... args) { return Table::emplace(T(std::forward<Args>(args)...)); }
967
968 friend bool operator==(const FlatHashSet& lhs, const FlatHashSet& rhs) {
969 if(lhs.size() != rhs.size())
970 return false;
971 for(const T& value : lhs) {
972 if(rhs.find(value) == rhs.end())
973 return false;
974 }
975 return true;
976 }
977 friend bool operator!=(const FlatHashSet& lhs, const FlatHashSet& rhs) { return !(lhs == rhs); }
978 };
979
980 template<typename T> struct power_of_two_std_hash : std::hash<T> { typedef power_of_two_hash_policy hash_policy; };
981
982} // namespace CeresEngine
Definition FlatHashMap.hpp:883
Table::iterator insert_or_assign(typename Table::const_iterator, const key_type &key, M &&m)
Definition FlatHashMap.hpp:923
V & at(const K &key)
Definition FlatHashMap.hpp:896
Table::iterator insert_or_assign(typename Table::const_iterator, key_type &&key, M &&m)
Definition FlatHashMap.hpp:926
Pair< typename Table::iterator, bool > emplace()
Definition FlatHashMap.hpp:910
K key_type
Definition FlatHashMap.hpp:888
Pair< typename Table::iterator, bool > insert_or_assign(key_type &&key, M &&m)
Definition FlatHashMap.hpp:917
friend bool operator!=(const FlatHashMap &lhs, const FlatHashMap &rhs)
Definition FlatHashMap.hpp:942
V & operator[](const K &key)
Definition FlatHashMap.hpp:894
const V & at(const K &key) const
Definition FlatHashMap.hpp:902
V mapped_type
Definition FlatHashMap.hpp:889
friend bool operator==(const FlatHashMap &lhs, const FlatHashMap &rhs)
Definition FlatHashMap.hpp:930
V & operator[](K &&key)
Definition FlatHashMap.hpp:895
FlatHashMap()
Definition FlatHashMap.hpp:892
Pair< typename Table::iterator, bool > insert_or_assign(const key_type &key, M &&m)
Definition FlatHashMap.hpp:911
Definition FlatHashMap.hpp:952
friend bool operator==(const FlatHashSet &lhs, const FlatHashSet &rhs)
Definition FlatHashMap.hpp:968
Pair< typename Table::iterator, bool > emplace(const key_type &arg)
Definition FlatHashMap.hpp:963
Pair< typename Table::iterator, bool > emplace(key_type &arg)
Definition FlatHashMap.hpp:964
friend bool operator!=(const FlatHashSet &lhs, const FlatHashSet &rhs)
Definition FlatHashMap.hpp:977
Pair< typename Table::iterator, bool > emplace(Args &&... args)
Definition FlatHashMap.hpp:962
Pair< typename Table::iterator, bool > emplace(key_type &&arg)
Definition FlatHashMap.hpp:966
Pair< typename Table::iterator, bool > emplace(const key_type &&arg)
Definition FlatHashMap.hpp:965
FlatHashSet()
Definition FlatHashMap.hpp:960
T key_type
Definition FlatHashMap.hpp:957
Definition FlatHashMap.hpp:151
void insert(std::initializer_list< value_type > il)
Definition FlatHashMap.hpp:370
SherwoodV3Table(SherwoodV3Table &&other) noexcept
Definition FlatHashMap.hpp:215
std::ptrdiff_t difference_type
Definition FlatHashMap.hpp:160
SherwoodV3Table()
Definition FlatHashMap.hpp:169
EntryPointer entries
Definition FlatHashMap.hpp:494
HashPolicySelector< ArgumentHash >::type hash_policy
Definition FlatHashMap.hpp:496
const allocator_type & get_allocator() const
Definition FlatHashMap.hpp:267
size_t num_buckets_for_reserve(const size_t num_elements) const
Definition FlatHashMap.hpp:506
void swap(SherwoodV3Table &other)
Definition FlatHashMap.hpp:467
size_t max_size() const
Definition FlatHashMap.hpp:477
iterator find(const FindKey &key)
Definition FlatHashMap.hpp:322
SherwoodV3Table & operator=(SherwoodV3Table &&other) noexcept
Definition FlatHashMap.hpp:240
const_iterator cbegin() const
Definition FlatHashMap.hpp:317
void reset_to_empty_state()
Definition FlatHashMap.hpp:565
size_t erase(const FindKey &key)
Definition FlatHashMap.hpp:447
size_t hash_object(const U &key) const
Definition FlatHashMap.hpp:574
size_t num_slots_minus_one
Definition FlatHashMap.hpp:495
SherwoodV3Table(std::initializer_list< T > il, size_type bucket_count, const ArgumentHash &hash, const ArgumentAlloc &alloc)
Definition FlatHashMap.hpp:200
detailv3::SherwoodV3Entry< T > Entry
Definition FlatHashMap.hpp:152
size_t bucket_count() const
Definition FlatHashMap.hpp:478
Pair< iterator, bool > insert(value_type &&value)
Definition FlatHashMap.hpp:360
Pair< iterator, bool > insert(const value_type &value)
Definition FlatHashMap.hpp:359
value_type & reference
Definition FlatHashMap.hpp:164
typename AllocatorTraits::pointer EntryPointer
Definition FlatHashMap.hpp:154
void rehash(size_t num_buckets)
Definition FlatHashMap.hpp:372
void swap_pointers(SherwoodV3Table &other)
Definition FlatHashMap.hpp:511
iterator insert(const_iterator, const value_type &value)
Definition FlatHashMap.hpp:362
void grow()
Definition FlatHashMap.hpp:557
bool compares_equal(const L &lhs, const R &rhs)
Definition FlatHashMap.hpp:575
iterator begin()
Definition FlatHashMap.hpp:305
void rehash_for_other_container(const SherwoodV3Table &other)
Definition FlatHashMap.hpp:509
int8_t max_lookups
Definition FlatHashMap.hpp:497
~SherwoodV3Table()
Definition FlatHashMap.hpp:262
SherwoodV3Table(size_type bucket_count, const ArgumentHash &hash, const ArgumentAlloc &alloc)
Definition FlatHashMap.hpp:176
size_t hash_object(const U &key)
Definition FlatHashMap.hpp:573
SherwoodV3Table(std::initializer_list< T > il, size_type bucket_count=0, const ArgumentHash &hash=ArgumentHash(), const ArgumentEqual &equal=ArgumentEqual(), const ArgumentAlloc &alloc=ArgumentAlloc())
Definition FlatHashMap.hpp:191
float max_load_factor() const
Definition FlatHashMap.hpp:489
bool empty() const
Definition FlatHashMap.hpp:491
EntryAlloc allocator_type
Definition FlatHashMap.hpp:163
size_t count(const FindKey &key) const
Definition FlatHashMap.hpp:332
void insert(It begin, It end)
Definition FlatHashMap.hpp:365
const_iterator cend() const
Definition FlatHashMap.hpp:320
SherwoodV3Table(const SherwoodV3Table &other)
Definition FlatHashMap.hpp:202
templated_iterator< const value_type > const_iterator
Definition FlatHashMap.hpp:303
const_iterator begin() const
Definition FlatHashMap.hpp:311
SherwoodV3Table(SherwoodV3Table &&other, const ArgumentAlloc &alloc) noexcept
Definition FlatHashMap.hpp:218
Pair< const_iterator, const_iterator > equal_range(const FindKey &key) const
Definition FlatHashMap.hpp:340
SherwoodV3Table(It first, It last, size_type bucket_count, const ArgumentHash &hash, const ArgumentAlloc &alloc)
Definition FlatHashMap.hpp:189
SherwoodV3Table(It first, It last, size_type bucket_count, const ArgumentAlloc &alloc)
Definition FlatHashMap.hpp:186
const ArgumentEqual & key_eq() const
Definition FlatHashMap.hpp:268
float _max_load_factor
Definition FlatHashMap.hpp:498
size_t size_type
Definition FlatHashMap.hpp:159
Pair< iterator, bool > emplace_new_key(int8_t distance_from_desired, EntryPointer current_entry, Key &&key, Args &&... args)
Definition FlatHashMap.hpp:522
void clear()
Definition FlatHashMap.hpp:457
templated_iterator< value_type > iterator
Definition FlatHashMap.hpp:302
void shrink_to_fit()
Definition FlatHashMap.hpp:465
size_t size() const
Definition FlatHashMap.hpp:476
SherwoodV3Table(It first, It last, size_type bucket_count=0, const ArgumentHash &hash=ArgumentHash(), const ArgumentEqual &equal=ArgumentEqual(), const ArgumentAlloc &alloc=ArgumentAlloc())
Definition FlatHashMap.hpp:180
iterator end()
Definition FlatHashMap.hpp:318
value_type * pointer
Definition FlatHashMap.hpp:166
const ArgumentHash & hash_function() const
Definition FlatHashMap.hpp:269
size_t num_elements
Definition FlatHashMap.hpp:499
void deallocate_data(EntryPointer begin, const size_t num_slots_minus_one, const int8_t max_lookups)
Definition FlatHashMap.hpp:559
float load_factor() const
Definition FlatHashMap.hpp:481
SherwoodV3Table(size_type bucket_count, const ArgumentAlloc &alloc)
Definition FlatHashMap.hpp:175
ArgumentHash hasher
Definition FlatHashMap.hpp:161
iterator emplace_hint(const_iterator, Args &&... args)
Definition FlatHashMap.hpp:361
T value_type
Definition FlatHashMap.hpp:158
std::allocator_traits< EntryAlloc > AllocatorTraits
Definition FlatHashMap.hpp:153
void max_load_factor(const float value)
Definition FlatHashMap.hpp:488
const value_type * const_pointer
Definition FlatHashMap.hpp:167
Pair< iterator, iterator > equal_range(const FindKey &key)
Definition FlatHashMap.hpp:333
const value_type & const_reference
Definition FlatHashMap.hpp:165
SherwoodV3Table(const SherwoodV3Table &other, const ArgumentAlloc &alloc)
Definition FlatHashMap.hpp:204
Pair< iterator, bool > emplace(Key &&key, Args &&... args)
Definition FlatHashMap.hpp:348
const_iterator end() const
Definition FlatHashMap.hpp:319
SherwoodV3Table & operator=(const SherwoodV3Table &other)
Definition FlatHashMap.hpp:222
SherwoodV3Table(const size_type bucket_count, const ArgumentHash &hash=ArgumentHash(), const ArgumentEqual &equal=ArgumentEqual(), const ArgumentAlloc &alloc=ArgumentAlloc())
Definition FlatHashMap.hpp:170
size_t bucket(const FindKey &key) const
Definition FlatHashMap.hpp:480
convertible_to_iterator erase(const_iterator to_erase)
Definition FlatHashMap.hpp:413
static int8_t compute_max_lookups(const size_t num_buckets)
Definition FlatHashMap.hpp:501
iterator erase(const_iterator begin_it, const_iterator end_it)
Definition FlatHashMap.hpp:424
SherwoodV3Table(std::initializer_list< T > il, size_type bucket_count, const ArgumentAlloc &alloc)
Definition FlatHashMap.hpp:198
SherwoodV3Table(const ArgumentAlloc &alloc)
Definition FlatHashMap.hpp:178
size_type max_bucket_count() const
Definition FlatHashMap.hpp:479
ArgumentEqual key_equal
Definition FlatHashMap.hpp:162
iterator insert(const_iterator, value_type &&value)
Definition FlatHashMap.hpp:363
void reserve(const size_t num_elements)
Definition FlatHashMap.hpp:403
const_iterator find(const FindKey &key) const
Definition FlatHashMap.hpp:331
void void_t
Definition FlatHashMap.hpp:144
size_t next_power_of_two(std::uint64_t i)
Definition FlatHashMap.hpp:132
int8_t log2(std::uint64_t value)
Definition FlatHashMap.hpp:111
Definition Application.hpp:19
std::pair< First, Second > Pair
Pair is a struct template that provides a way to store two heterogeneous objects as a single unit.
Definition Pair.hpp:18
constexpr FindAlgorithmFunctor find
Finds the first element equal to another element.
Definition Find.hpp:70
@ Key
The event is of type KeyEvent.
void copy(const A &a, B &b, T &&t=T())
Copies values from one container to another.
Definition Iterator.hpp:564
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
decltype(&*std::declval< I >() found)(const I &it, C &container)
Returns a pointer to the value if found, otherwise nullptr.
Definition Iterator.hpp:572
A reflection pre-processor that creates a hash for an object.
Definition Hash.hpp:48
size_t hash
The computed hash.
Definition Hash.hpp:56
void operator()(T &, const T &)
Definition FlatHashMap.hpp:128
void operator()(T &, T &&)
Definition FlatHashMap.hpp:129
Definition FlatHashMap.hpp:123
void operator()(T &lhs, T &&rhs)
Definition FlatHashMap.hpp:125
void operator()(T &lhs, const T &rhs)
Definition FlatHashMap.hpp:124
FunctorStorage(const function_ptr function)
Definition FlatHashMap.hpp:39
Result operator()(Args... args) const
Definition FlatHashMap.hpp:40
Definition FlatHashMap.hpp:27
FunctorStorage(const Functor &functor)
Definition FlatHashMap.hpp:29
Result operator()(Args &&... args) const
Definition FlatHashMap.hpp:33
Result operator()(Args &&... args)
Definition FlatHashMap.hpp:31
Definition FlatHashMap.hpp:146
fibonacci_hash_policy type
Definition FlatHashMap.hpp:146
Definition FlatHashMap.hpp:57
FunctorStorage< bool, key_equal > equality_storage
Definition FlatHashMap.hpp:58
bool operator()(const Pair< FL, SL > &lhs, const Pair< FR, SR > &rhs)
Definition FlatHashMap.hpp:77
bool operator()(const value_type &lhs, const Pair< F, S > &rhs)
Definition FlatHashMap.hpp:71
KeyOrValueEquality(const key_equal &equality)
Definition FlatHashMap.hpp:60
bool operator()(const key_type &lhs, const key_type &rhs)
Definition FlatHashMap.hpp:61
bool operator()(const key_type &lhs, const Pair< F, S > &rhs)
Definition FlatHashMap.hpp:65
bool operator()(const value_type &lhs, const key_type &rhs)
Definition FlatHashMap.hpp:63
bool operator()(const value_type &lhs, const value_type &rhs)
Definition FlatHashMap.hpp:64
bool operator()(const key_type &lhs, const value_type &rhs)
Definition FlatHashMap.hpp:62
bool operator()(const Pair< F, S > &lhs, const value_type &rhs)
Definition FlatHashMap.hpp:74
bool operator()(const Pair< F, S > &lhs, const key_type &rhs)
Definition FlatHashMap.hpp:68
Definition FlatHashMap.hpp:45
size_t operator()(const value_type &value)
Definition FlatHashMap.hpp:51
size_t operator()(const Pair< F, S > &value)
Definition FlatHashMap.hpp:53
size_t operator()(const key_type &key)
Definition FlatHashMap.hpp:49
size_t operator()(const Pair< F, S > &value) const
Definition FlatHashMap.hpp:54
FunctorStorage< size_t, hasher > hasher_storage
Definition FlatHashMap.hpp:46
size_t operator()(const value_type &value) const
Definition FlatHashMap.hpp:52
size_t operator()(const key_type &key) const
Definition FlatHashMap.hpp:50
KeyOrValueHasher(const hasher &hash)
Definition FlatHashMap.hpp:48
Definition FlatHashMap.hpp:82
~SherwoodV3Entry()
Definition FlatHashMap.hpp:85
SherwoodV3Entry()
Definition FlatHashMap.hpp:83
void emplace(const int8_t distance, Args &&... args)
Definition FlatHashMap.hpp:94
bool has_value() const
Definition FlatHashMap.hpp:91
int8_t distance_from_desired
Definition FlatHashMap.hpp:104
bool is_empty() const
Definition FlatHashMap.hpp:92
static SherwoodV3Entry * empty_default_table()
Definition FlatHashMap.hpp:86
SherwoodV3Entry(const int8_t distance_from_desired)
Definition FlatHashMap.hpp:84
bool is_at_desired_position() const
Definition FlatHashMap.hpp:93
static constexpr int8_t special_end_value
Definition FlatHashMap.hpp:105
T value
Definition FlatHashMap.hpp:107
void destroy_value()
Definition FlatHashMap.hpp:99
EntryPointer it
Definition FlatHashMap.hpp:578
templated_iterator(EntryPointer current)
Definition FlatHashMap.hpp:273
std::forward_iterator_tag iterator_category
Definition FlatHashMap.hpp:276
ValueType * pointer
Definition FlatHashMap.hpp:279
friend bool operator==(const templated_iterator &lhs, const templated_iterator &rhs)
Definition FlatHashMap.hpp:282
ValueType & operator*() const
Definition FlatHashMap.hpp:297
EntryPointer current
Definition FlatHashMap.hpp:274
ValueType value_type
Definition FlatHashMap.hpp:277
templated_iterator operator++(int)
Definition FlatHashMap.hpp:291
ptrdiff_t difference_type
Definition FlatHashMap.hpp:278
ValueType & reference
Definition FlatHashMap.hpp:280
ValueType * operator->() const
Definition FlatHashMap.hpp:298
templated_iterator & operator++()
Definition FlatHashMap.hpp:285
friend bool operator!=(const templated_iterator &lhs, const templated_iterator &rhs)
Definition FlatHashMap.hpp:283
Definition FlatHashMap.hpp:865
size_t keep_in_range(const size_t index, const size_t num_slots_minus_one) const
Definition FlatHashMap.hpp:867
void commit(const int8_t shift)
Definition FlatHashMap.hpp:873
size_t index_for_hash(const size_t hash, size_t) const
Definition FlatHashMap.hpp:866
int8_t shift
Definition FlatHashMap.hpp:877
void reset()
Definition FlatHashMap.hpp:874
int8_t next_size_over(size_t &size) const
Definition FlatHashMap.hpp:869
Definition FlatHashMap.hpp:854
void reset()
Definition FlatHashMap.hpp:862
size_t keep_in_range(const size_t index, const size_t num_slots_minus_one) const
Definition FlatHashMap.hpp:856
size_t index_for_hash(const size_t hash, const size_t num_slots_minus_one) const
Definition FlatHashMap.hpp:855
int8_t next_size_over(size_t &size) const
Definition FlatHashMap.hpp:857
void commit(int8_t)
Definition FlatHashMap.hpp:861
Definition FlatHashMap.hpp:980
power_of_two_hash_policy hash_policy
Definition FlatHashMap.hpp:980
Definition FlatHashMap.hpp:596
static size_t mod543724411781(const size_t hash)
Definition FlatHashMap.hpp:708
static size_t mod251(const size_t hash)
Definition FlatHashMap.hpp:615
static size_t mod631(const size_t hash)
Definition FlatHashMap.hpp:619
static size_t mod43843189232363(const size_t hash)
Definition FlatHashMap.hpp:727
static size_t mod1061961721(const size_t hash)
Definition FlatHashMap.hpp:681
static size_t mod421439783(const size_t hash)
Definition FlatHashMap.hpp:677
static size_t mod2613229(const size_t hash)
Definition FlatHashMap.hpp:655
static size_t mod27619478504183(const size_t hash)
Definition FlatHashMap.hpp:725
static size_t mod17816761525534927(const size_t hash)
Definition FlatHashMap.hpp:753
static size_t mod10960797308051(const size_t hash)
Definition FlatHashMap.hpp:721
static size_t mod701491027718027(const size_t hash)
Definition FlatHashMap.hpp:739
static size_t mod883823312134381(const size_t hash)
Definition FlatHashMap.hpp:740
static size_t mod0(size_t)
Definition FlatHashMap.hpp:597
static size_t mod105359939(const size_t hash)
Definition FlatHashMap.hpp:671
static size_t mod67965551447(const size_t hash)
Definition FlatHashMap.hpp:699
static size_t mod5226491(const size_t hash)
Definition FlatHashMap.hpp:658
static size_t mod1685759167(const size_t hash)
Definition FlatHashMap.hpp:683
static size_t mod5611928221744609(const size_t hash)
Definition FlatHashMap.hpp:748
static size_t mod397(const size_t hash)
Definition FlatHashMap.hpp:617
static size_t mod83624237(const size_t hash)
Definition FlatHashMap.hpp:670
static size_t mod1306601(const size_t hash)
Definition FlatHashMap.hpp:652
static size_t mod8089(const size_t hash)
Definition FlatHashMap.hpp:630
mod_function current_mod_function
Definition FlatHashMap.hpp:851
static size_t mod59(const size_t hash)
Definition FlatHashMap.hpp:609
static size_t mod1259(const size_t hash)
Definition FlatHashMap.hpp:622
size_t keep_in_range(const size_t index, const size_t num_slots_minus_one) const
Definition FlatHashMap.hpp:848
static size_t mod3620140286502504283(const size_t hash)
Definition FlatHashMap.hpp:776
static size_t mod2675975881(const size_t hash)
Definition FlatHashMap.hpp:685
static size_t mod210719881(const size_t hash)
Definition FlatHashMap.hpp:674
static size_t mod51437(const size_t hash)
Definition FlatHashMap.hpp:638
static size_t mod33982775741(const size_t hash)
Definition FlatHashMap.hpp:696
static size_t mod9122181901073924329(const size_t hash)
Definition FlatHashMap.hpp:780
static size_t mod113129383953203213(const size_t hash)
Definition FlatHashMap.hpp:761
static size_t mod6904869625999(const size_t hash)
Definition FlatHashMap.hpp:719
static size_t mod411527(const size_t hash)
Definition FlatHashMap.hpp:647
static size_t mod556773797672909(const size_t hash)
Definition FlatHashMap.hpp:738
static size_t mod2805964110872297(const size_t hash)
Definition FlatHashMap.hpp:745
static size_t mod220955828033581(const size_t hash)
Definition FlatHashMap.hpp:734
static size_t mod2539(const size_t hash)
Definition FlatHashMap.hpp:625
static size_t mod29(const size_t hash)
Definition FlatHashMap.hpp:606
static size_t mod7070586497075177(const size_t hash)
Definition FlatHashMap.hpp:749
static size_t mod2873307249533267101(const size_t hash)
Definition FlatHashMap.hpp:775
static size_t mod10453007(const size_t hash)
Definition FlatHashMap.hpp:661
static size_t mod1087448823553(const size_t hash)
Definition FlatHashMap.hpp:711
void reset()
Definition FlatHashMap.hpp:845
static size_t mod334496971(const size_t hash)
Definition FlatHashMap.hpp:676
static size_t mod4027(const size_t hash)
Definition FlatHashMap.hpp:627
static size_t mod1370099663459(const size_t hash)
Definition FlatHashMap.hpp:712
static size_t mod530980861(const size_t hash)
Definition FlatHashMap.hpp:678
static size_t mod4148279(const size_t hash)
Definition FlatHashMap.hpp:657
static size_t mod1009(const size_t hash)
Definition FlatHashMap.hpp:621
static size_t mod3452434812973(const size_t hash)
Definition FlatHashMap.hpp:716
static size_t mod1140272737634240411(const size_t hash)
Definition FlatHashMap.hpp:771
static size_t mod570136368817120201(const size_t hash)
Definition FlatHashMap.hpp:768
static size_t mod1597(const size_t hash)
Definition FlatHashMap.hpp:623
static size_t mod22447712886978529(const size_t hash)
Definition FlatHashMap.hpp:754
static size_t mod13169977(const size_t hash)
Definition FlatHashMap.hpp:662
static size_t mod2(const size_t hash)
Definition FlatHashMap.hpp:598
static size_t mod2280545475268481167(const size_t hash)
Definition FlatHashMap.hpp:774
static size_t mod87686378464759(const size_t hash)
Definition FlatHashMap.hpp:730
static size_t mod1810070143251252131(const size_t hash)
Definition FlatHashMap.hpp:773
static size_t mod205759(const size_t hash)
Definition FlatHashMap.hpp:644
static size_t mod11493228998133068689(const size_t hash)
Definition FlatHashMap.hpp:781
static size_t mod431554351609(const size_t hash)
Definition FlatHashMap.hpp:707
static size_t mod12853(const size_t hash)
Definition FlatHashMap.hpp:632
static size_t mod285068184408560057(const size_t hash)
Definition FlatHashMap.hpp:765
static size_t mod259229(const size_t hash)
Definition FlatHashMap.hpp:645
static size_t mod175372756929481(const size_t hash)
Definition FlatHashMap.hpp:733
static size_t mod3(const size_t hash)
Definition FlatHashMap.hpp:599
static size_t mod85631228929(const size_t hash)
Definition FlatHashMap.hpp:700
static size_t mod499(const size_t hash)
Definition FlatHashMap.hpp:618
static size_t mod2740199326961(const size_t hash)
Definition FlatHashMap.hpp:715
static size_t mod13809739252051(const size_t hash)
Definition FlatHashMap.hpp:722
static size_t mod26972146961(const size_t hash)
Definition FlatHashMap.hpp:695
static size_t mod4561090950536962147(const size_t hash)
Definition FlatHashMap.hpp:777
static size_t mod1436653624766633509(const size_t hash)
Definition FlatHashMap.hpp:772
static size_t mod7(const size_t hash)
Definition FlatHashMap.hpp:601
static size_t mod718326812383316683(const size_t hash)
Definition FlatHashMap.hpp:769
static size_t mod1402982055436147(const size_t hash)
Definition FlatHashMap.hpp:742
static size_t mod40823(const size_t hash)
Definition FlatHashMap.hpp:637
static size_t mod97(const size_t hash)
Definition FlatHashMap.hpp:611
static size_t mod5(const size_t hash)
Definition FlatHashMap.hpp:600
static size_t mod10703903591(const size_t hash)
Definition FlatHashMap.hpp:691
static size_t mod110477914016779(const size_t hash)
Definition FlatHashMap.hpp:731
static size_t mod5480398654009(const size_t hash)
Definition FlatHashMap.hpp:718
static size_t mod4349795294267(const size_t hash)
Definition FlatHashMap.hpp:717
static size_t mod653267(const size_t hash)
Definition FlatHashMap.hpp:649
static size_t mod1646237(const size_t hash)
Definition FlatHashMap.hpp:653
static size_t mod17(const size_t hash)
Definition FlatHashMap.hpp:604
static size_t mod5351951779(const size_t hash)
Definition FlatHashMap.hpp:688
static size_t mod129607(const size_t hash)
Definition FlatHashMap.hpp:642
static size_t mod1767646624268779(const size_t hash)
Definition FlatHashMap.hpp:743
static size_t mod64811(const size_t hash)
Definition FlatHashMap.hpp:639
static size_t mod4454190381383713(const size_t hash)
Definition FlatHashMap.hpp:747
static size_t mod52679969(const size_t hash)
Definition FlatHashMap.hpp:668
static size_t mod26339969(const size_t hash)
Definition FlatHashMap.hpp:665
static size_t mod823117(const size_t hash)
Definition FlatHashMap.hpp:650
static size_t mod13(const size_t hash)
Definition FlatHashMap.hpp:603
static size_t mod11(const size_t hash)
Definition FlatHashMap.hpp:602
static size_t mod668993977(const size_t hash)
Definition FlatHashMap.hpp:679
void commit(const mod_function new_mod_function)
Definition FlatHashMap.hpp:844
static size_t mod3371518343(const size_t hash)
Definition FlatHashMap.hpp:686
static size_t mod7240280573005008577(const size_t hash)
Definition FlatHashMap.hpp:779
static size_t mod73(const size_t hash)
Definition FlatHashMap.hpp:610
static size_t mod197(const size_t hash)
Definition FlatHashMap.hpp:614
static size_t mod1337987929(const size_t hash)
Definition FlatHashMap.hpp:682
static size_t mod6743036717(const size_t hash)
Definition FlatHashMap.hpp:689
static size_t mod265490441(const size_t hash)
Definition FlatHashMap.hpp:675
static size_t mod25717(const size_t hash)
Definition FlatHashMap.hpp:635
static size_t mod2074129(const size_t hash)
Definition FlatHashMap.hpp:654
static size_t mod53944293929(const size_t hash)
Definition FlatHashMap.hpp:698
static size_t mod41812097(const size_t hash)
Definition FlatHashMap.hpp:667
static size_t mod278386898836457(const size_t hash)
Definition FlatHashMap.hpp:735
static size_t mod135931102921(const size_t hash)
Definition FlatHashMap.hpp:702
static size_t mod342524915839(const size_t hash)
Definition FlatHashMap.hpp:706
static size_t mod6584983(const size_t hash)
Definition FlatHashMap.hpp:659
static size_t mod102877(const size_t hash)
Definition FlatHashMap.hpp:641
static size_t mod6421(const size_t hash)
Definition FlatHashMap.hpp:629
static size_t mod66372617(const size_t hash)
Definition FlatHashMap.hpp:669
static size_t mod89790851547914507(const size_t hash)
Definition FlatHashMap.hpp:760
static size_t mod3292489(const size_t hash)
Definition FlatHashMap.hpp:656
static size_t mod797(const size_t hash)
Definition FlatHashMap.hpp:620
static size_t mod17399181177241(const size_t hash)
Definition FlatHashMap.hpp:723
static size_t mod1113547595345903(const size_t hash)
Definition FlatHashMap.hpp:741
static size_t mod34798362354533(const size_t hash)
Definition FlatHashMap.hpp:726
static size_t mod142534092204280003(const size_t hash)
Definition FlatHashMap.hpp:762
static size_t mod452517535812813007(const size_t hash)
Definition FlatHashMap.hpp:767
static size_t mod167248483(const size_t hash)
Definition FlatHashMap.hpp:673
static size_t mod14480561146010017169(const size_t hash)
Definition FlatHashMap.hpp:782
static size_t mod18446744073709551557(const size_t hash)
Definition FlatHashMap.hpp:783
static size_t mod441911656067171(const size_t hash)
Definition FlatHashMap.hpp:737
size_t(*)(size_t) mod_function
Definition FlatHashMap.hpp:785
static size_t mod33186281(const size_t hash)
Definition FlatHashMap.hpp:666
static size_t mod8908380762767489(const size_t hash)
Definition FlatHashMap.hpp:750
static size_t mod271862205833(const size_t hash)
Definition FlatHashMap.hpp:705
static size_t mod359163406191658253(const size_t hash)
Definition FlatHashMap.hpp:766
static size_t mod42815614441(const size_t hash)
Definition FlatHashMap.hpp:697
static size_t mod16193(const size_t hash)
Definition FlatHashMap.hpp:633
static size_t mod326617(const size_t hash)
Definition FlatHashMap.hpp:646
static size_t mod151(const size_t hash)
Definition FlatHashMap.hpp:613
static size_t mod2011(const size_t hash)
Definition FlatHashMap.hpp:624
static size_t mod10193(const size_t hash)
Definition FlatHashMap.hpp:631
static size_t mod2123923447(const size_t hash)
Definition FlatHashMap.hpp:684
static size_t mod4247846927(const size_t hash)
Definition FlatHashMap.hpp:687
static size_t mod81649(const size_t hash)
Definition FlatHashMap.hpp:640
static size_t mod1037059(const size_t hash)
Definition FlatHashMap.hpp:651
static size_t mod35633523051069991(const size_t hash)
Definition FlatHashMap.hpp:756
static size_t mod313(const size_t hash)
Definition FlatHashMap.hpp:616
static size_t mod171262457903(const size_t hash)
Definition FlatHashMap.hpp:703
static size_t mod14141172994150357(const size_t hash)
Definition FlatHashMap.hpp:752
static size_t mod21407807219(const size_t hash)
Definition FlatHashMap.hpp:694
static size_t mod163307(const size_t hash)
Definition FlatHashMap.hpp:643
static size_t mod350745513859007(const size_t hash)
Definition FlatHashMap.hpp:736
static size_t mod2174897647073(const size_t hash)
Definition FlatHashMap.hpp:714
static size_t mod842879579(const size_t hash)
Definition FlatHashMap.hpp:680
static size_t mod8699590588571(const size_t hash)
Definition FlatHashMap.hpp:720
static size_t mod37(const size_t hash)
Definition FlatHashMap.hpp:607
static size_t mod71267046102139967(const size_t hash)
Definition FlatHashMap.hpp:759
size_t index_for_hash(const size_t hash, size_t) const
Definition FlatHashMap.hpp:847
static size_t mod863108703229(const size_t hash)
Definition FlatHashMap.hpp:710
static size_t mod179581703095829107(const size_t hash)
Definition FlatHashMap.hpp:763
static size_t mod20399(const size_t hash)
Definition FlatHashMap.hpp:634
static size_t mod32401(const size_t hash)
Definition FlatHashMap.hpp:636
static size_t mod55238957008387(const size_t hash)
Definition FlatHashMap.hpp:728
static size_t mod3535293248537579(const size_t hash)
Definition FlatHashMap.hpp:746
static size_t mod226258767906406483(const size_t hash)
Definition FlatHashMap.hpp:764
static size_t mod56564691976601587(const size_t hash)
Definition FlatHashMap.hpp:758
static size_t mod685049831731(const size_t hash)
Definition FlatHashMap.hpp:709
mod_function next_size_over(size_t &size) const
Definition FlatHashMap.hpp:787
static size_t mod11223856443489329(const size_t hash)
Definition FlatHashMap.hpp:751
static size_t mod139193449418173(const size_t hash)
Definition FlatHashMap.hpp:732
static size_t mod20906033(const size_t hash)
Definition FlatHashMap.hpp:664
static size_t mod905035071625626043(const size_t hash)
Definition FlatHashMap.hpp:770
static size_t mod107888587883(const size_t hash)
Definition FlatHashMap.hpp:701
static size_t mod16991387857(const size_t hash)
Definition FlatHashMap.hpp:693
static size_t mod21921594616111(const size_t hash)
Definition FlatHashMap.hpp:724
static size_t mod127(const size_t hash)
Definition FlatHashMap.hpp:612
static size_t mod518509(const size_t hash)
Definition FlatHashMap.hpp:648
static size_t mod8495693897(const size_t hash)
Definition FlatHashMap.hpp:690
static size_t mod5087(const size_t hash)
Definition FlatHashMap.hpp:628
static size_t mod69596724709081(const size_t hash)
Definition FlatHashMap.hpp:729
static size_t mod3203(const size_t hash)
Definition FlatHashMap.hpp:626
static size_t mod1726217406467(const size_t hash)
Definition FlatHashMap.hpp:713
static size_t mod8296553(const size_t hash)
Definition FlatHashMap.hpp:660
static size_t mod132745199(const size_t hash)
Definition FlatHashMap.hpp:672
static size_t mod215777175787(const size_t hash)
Definition FlatHashMap.hpp:704
static size_t mod16593127(const size_t hash)
Definition FlatHashMap.hpp:663
static size_t mod47(const size_t hash)
Definition FlatHashMap.hpp:608
static size_t mod13486073473(const size_t hash)
Definition FlatHashMap.hpp:692
static size_t mod44895425773957261(const size_t hash)
Definition FlatHashMap.hpp:757
static size_t mod2227095190691797(const size_t hash)
Definition FlatHashMap.hpp:744
static size_t mod23(const size_t hash)
Definition FlatHashMap.hpp:605
static size_t mod28282345988300791(const size_t hash)
Definition FlatHashMap.hpp:755
static size_t mod5746614499066534157(const size_t hash)
Definition FlatHashMap.hpp:778