24#ifndef TSL_ROBIN_SET_H
25#define TSL_ROBIN_SET_H
29#include <initializer_list>
86 template <
class Key,
class Hash = std::hash<Key>,
class KeyEqual = std::equal_to<Key>,
87 class Allocator = std::allocator<Key>,
bool StoreHash = false,
88 class GrowthPolicy = tsl::rh::power_of_two_growth_policy<2>>
105 StoreHash, GrowthPolicy>;
128 const KeyEqual &equal = KeyEqual(),
const Allocator &alloc = Allocator())
145 template <
class InputIt>
147 const Hash &hash = Hash(),
const KeyEqual &equal = KeyEqual(),
148 const Allocator &alloc = Allocator())
154 template <
class InputIt>
160 template <
class InputIt>
162 const Allocator &alloc)
169 const KeyEqual &equal = KeyEqual(),
const Allocator &alloc = Allocator())
175 const Allocator &alloc)
181 const Allocator &alloc)
235 template <
class InputIt>
void insert(InputIt first, InputIt last) {
m_ht.
insert(first, last); }
237 void insert(std::initializer_list<value_type> ilist)
249 template <
class... Args> std::pair<iterator, bool>
emplace(Args &&...args)
278 return m_ht.
erase(key, precalculated_hash);
286 template <
class K,
class KE = KeyEqual,
287 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
300 template <
class K,
class KE = KeyEqual,
301 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
304 return m_ht.
erase(key, precalculated_hash);
321 return m_ht.
count(key, precalculated_hash);
329 template <
class K,
class KE = KeyEqual,
330 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
343 template <
class K,
class KE = KeyEqual,
344 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
347 return m_ht.
count(key, precalculated_hash);
359 return m_ht.
find(key, precalculated_hash);
369 return m_ht.
find(key, precalculated_hash);
377 template <
class K,
class KE = KeyEqual,
378 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
391 template <
class K,
class KE = KeyEqual,
392 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
395 return m_ht.
find(key, precalculated_hash);
401 template <
class K,
class KE = KeyEqual,
402 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
415 template <
class K,
class KE = KeyEqual,
416 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
419 return m_ht.
find(key, precalculated_hash);
429 bool contains(
const Key &key, std::size_t precalculated_hash)
const
439 template <
class K,
class KE = KeyEqual,
440 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
453 template <
class K,
class KE = KeyEqual,
454 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
455 bool contains(
const K &key, std::size_t precalculated_hash)
const
467 std::pair<iterator, iterator>
equal_range(
const Key &key, std::size_t precalculated_hash)
472 std::pair<const_iterator, const_iterator>
equal_range(
const Key &key)
const
480 std::pair<const_iterator, const_iterator>
equal_range(
const Key &key,
481 std::size_t precalculated_hash)
const
491 template <
class K,
class KE = KeyEqual,
492 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
505 template <
class K,
class KE = KeyEqual,
506 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
507 std::pair<iterator, iterator>
equal_range(
const K &key, std::size_t precalculated_hash)
515 template <
class K,
class KE = KeyEqual,
516 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
517 std::pair<const_iterator, const_iterator>
equal_range(
const K &key)
const
525 template <
class K,
class KE = KeyEqual,
526 typename std::enable_if<has_is_transparent<KE>::value>::type * =
nullptr>
527 std::pair<const_iterator, const_iterator>
equal_range(
const K &key,
528 std::size_t precalculated_hash)
const
583 for (
const auto &element_lhs : lhs) {
584 const auto it_element_rhs = rhs.
find(element_lhs);
585 if (it_element_rhs == rhs.
cend()) {
606 template <
class Serializer>
void serialize(Serializer &serializer)
const
637 template <
class Deserializer>
661 template <
class Key,
class Hash = std::hash<Key>,
class KeyEqual = std::equal_to<Key>,
662 class Allocator = std::allocator<Key>,
bool StoreHash = false>
Definition robin_hash.h:365
key_equal key_eq() const
Definition robin_hash.h:1073
static const size_type DEFAULT_INIT_BUCKETS_SIZE
Definition robin_hash.h:1508
iterator find(const K &key)
Definition robin_hash.h:972
Hash hasher
Definition robin_hash.h:382
const value_type * const_pointer
Definition robin_hash.h:388
iterator begin() noexcept
Definition robin_hash.h:664
bool empty() const noexcept
Definition robin_hash.h:695
typename KeySelect::key_type key_type
Definition robin_hash.h:378
float min_load_factor() const
Definition robin_hash.h:1041
KeyEqual key_equal
Definition robin_hash.h:383
std::pair< iterator, bool > insert(P &&value)
Definition robin_hash.h:719
hasher hash_function() const
Definition robin_hash.h:1071
value_type * pointer
Definition robin_hash.h:387
value_type & reference
Definition robin_hash.h:385
void rehash(size_type my_count)
Definition robin_hash.h:1057
void serialize(Serializer &serializer) const
Definition robin_hash.h:1083
bool contains(const K &key) const
Definition robin_hash.h:989
std::ptrdiff_t difference_type
Definition robin_hash.h:381
std::pair< iterator, bool > emplace(Args &&...args)
Definition robin_hash.h:773
iterator insert_hint(const_iterator hint, P &&value)
Definition robin_hash.h:724
size_type max_size() const noexcept
Definition robin_hash.h:699
const_iterator cbegin() const noexcept
Definition robin_hash.h:676
allocator_type get_allocator() const
Definition robin_hash.h:659
ValueType value_type
Definition robin_hash.h:379
robin_iterator< false > iterator
Definition robin_hash.h:389
float load_factor() const
Definition robin_hash.h:1032
const value_type & const_reference
Definition robin_hash.h:386
iterator erase(iterator pos)
Definition robin_hash.h:803
size_type bucket_count() const
Definition robin_hash.h:1022
void deserialize(Deserializer &deserializer, bool hash_compatible)
Definition robin_hash.h:1088
void swap(robin_hash &other)
Definition robin_hash.h:897
size_type count(const K &key) const
Definition robin_hash.h:960
const_iterator cend() const noexcept
Definition robin_hash.h:690
iterator end() noexcept
Definition robin_hash.h:686
float max_load_factor() const
Definition robin_hash.h:1043
size_type size() const noexcept
Definition robin_hash.h:697
std::pair< iterator, iterator > equal_range(const K &key)
Definition robin_hash.h:996
robin_iterator< true > const_iterator
Definition robin_hash.h:390
std::size_t size_type
Definition robin_hash.h:380
void reserve(size_type my_count)
Definition robin_hash.h:1063
iterator mutable_iterator(const_iterator pos)
Definition robin_hash.h:1078
Allocator allocator_type
Definition robin_hash.h:384
size_type max_bucket_count() const
Definition robin_hash.h:1024
iterator emplace_hint(const_iterator hint, Args &&...args)
Definition robin_hash.h:778
void clear() noexcept
Definition robin_hash.h:704
Definition robin_set.h:95
key_type & operator()(Key &key) noexcept
Definition robin_set.h:101
Key key_type
Definition robin_set.h:97
const key_type & operator()(const Key &key) const noexcept
Definition robin_set.h:99
Definition robin_set.h:90
std::pair< iterator, bool > insert(const value_type &value)
Definition robin_set.h:221
std::pair< const_iterator, const_iterator > equal_range(const Key &key, std::size_t precalculated_hash) const
Definition robin_set.h:480
robin_set(InputIt first, InputIt last, size_type bucket_count, const Allocator &alloc)
Definition robin_set.h:155
ht m_ht
Definition robin_set.h:654
size_type count(const Key &key) const
Definition robin_set.h:312
iterator erase(iterator pos)
Definition robin_set.h:266
typename ht::pointer pointer
Definition robin_set.h:117
const_iterator find(const K &key) const
Definition robin_set.h:403
robin_set(size_type bucket_count, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator())
Definition robin_set.h:127
const_iterator find(const K &key, std::size_t precalculated_hash) const
Definition robin_set.h:417
const_iterator find(const Key &key) const
Definition robin_set.h:362
robin_set(std::initializer_list< value_type > init, size_type bucket_count, const Allocator &alloc)
Definition robin_set.h:174
iterator erase(const_iterator first, const_iterator last)
Definition robin_set.h:268
bool empty() const noexcept
Definition robin_set.h:212
void reserve(size_type my_count)
Definition robin_set.h:560
typename ht::hasher hasher
Definition robin_set.h:112
typename ht::const_reference const_reference
Definition robin_set.h:116
const_iterator cbegin() const noexcept
Definition robin_set.h:203
iterator insert(const_iterator hint, const value_type &value)
Definition robin_set.h:225
robin_set()
Definition robin_set.h:125
size_type max_size() const noexcept
Definition robin_set.h:214
void max_load_factor(float ml)
Definition robin_set.h:557
iterator insert(const_iterator hint, value_type &&value)
Definition robin_set.h:230
void serialize(Serializer &serializer) const
Definition robin_set.h:606
size_type erase(const key_type &key, std::size_t precalculated_hash)
Definition robin_set.h:276
iterator begin() noexcept
Definition robin_set.h:201
float load_factor() const
Definition robin_set.h:542
typename ht::size_type size_type
Definition robin_set.h:110
friend bool operator==(const robin_set &lhs, const robin_set &rhs)
Definition robin_set.h:577
std::pair< const_iterator, const_iterator > equal_range(const K &key, std::size_t precalculated_hash) const
Definition robin_set.h:527
std::pair< iterator, bool > emplace(Args &&...args)
Definition robin_set.h:249
robin_set(InputIt first, InputIt last, size_type bucket_count, const Hash &hash, const Allocator &alloc)
Definition robin_set.h:161
typename ht::const_iterator const_iterator
Definition robin_set.h:120
iterator find(const K &key, std::size_t precalculated_hash)
Definition robin_set.h:393
robin_set(size_type bucket_count, const Hash &hash, const Allocator &alloc)
Definition robin_set.h:138
size_type erase(const key_type &key)
Definition robin_set.h:269
iterator find(const Key &key)
Definition robin_set.h:350
void rehash(size_type my_count)
Definition robin_set.h:559
typename ht::value_type value_type
Definition robin_set.h:109
size_type erase(const K &key)
Definition robin_set.h:288
typename ht::reference reference
Definition robin_set.h:115
const_iterator find(const Key &key, std::size_t precalculated_hash) const
Definition robin_set.h:367
iterator find(const Key &key, std::size_t precalculated_hash)
Definition robin_set.h:357
friend bool operator!=(const robin_set &lhs, const robin_set &rhs)
Definition robin_set.h:646
key_equal key_eq() const
Definition robin_set.h:566
std::pair< const_iterator, const_iterator > equal_range(const K &key) const
Definition robin_set.h:517
typename ht::iterator iterator
Definition robin_set.h:119
iterator end() noexcept
Definition robin_set.h:205
typename ht::key_equal key_equal
Definition robin_set.h:113
void swap(robin_set &other)
Definition robin_set.h:307
std::pair< iterator, iterator > equal_range(const K &key, std::size_t precalculated_hash)
Definition robin_set.h:507
robin_set & operator=(std::initializer_list< value_type > ilist)
Definition robin_set.h:186
void min_load_factor(float ml)
Definition robin_set.h:556
typename ht::key_type key_type
Definition robin_set.h:108
size_type count(const K &key) const
Definition robin_set.h:331
size_type bucket_count() const
Definition robin_set.h:536
iterator erase(const_iterator pos)
Definition robin_set.h:267
std::pair< const_iterator, const_iterator > equal_range(const Key &key) const
Definition robin_set.h:472
size_type count(const K &key, std::size_t precalculated_hash) const
Definition robin_set.h:345
const_iterator cend() const noexcept
Definition robin_set.h:207
iterator emplace_hint(const_iterator hint, Args &&...args)
Definition robin_set.h:261
std::pair< iterator, iterator > equal_range(const Key &key)
Definition robin_set.h:460
bool contains(const K &key) const
Definition robin_set.h:441
const_iterator begin() const noexcept
Definition robin_set.h:202
const_iterator end() const noexcept
Definition robin_set.h:206
friend void swap(robin_set &lhs, robin_set &rhs)
Definition robin_set.h:651
robin_set(size_type bucket_count, const Allocator &alloc)
Definition robin_set.h:133
allocator_type get_allocator() const
Definition robin_set.h:196
std::pair< iterator, iterator > equal_range(const K &key)
Definition robin_set.h:493
robin_set(std::initializer_list< value_type > init, size_type bucket_count=ht::DEFAULT_INIT_BUCKETS_SIZE, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator())
Definition robin_set.h:167
iterator find(const K &key)
Definition robin_set.h:379
typename ht::const_pointer const_pointer
Definition robin_set.h:118
size_type erase(const K &key, std::size_t precalculated_hash)
Definition robin_set.h:302
typename ht::allocator_type allocator_type
Definition robin_set.h:114
std::pair< iterator, iterator > equal_range(const Key &key, std::size_t precalculated_hash)
Definition robin_set.h:467
float min_load_factor() const
Definition robin_set.h:544
robin_set(const Allocator &alloc)
Definition robin_set.h:143
typename ht::difference_type difference_type
Definition robin_set.h:111
void insert(std::initializer_list< value_type > ilist)
Definition robin_set.h:237
robin_set(InputIt first, InputIt last, size_type bucket_count=ht::DEFAULT_INIT_BUCKETS_SIZE, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &alloc=Allocator())
Definition robin_set.h:146
bool contains(const Key &key, std::size_t precalculated_hash) const
Definition robin_set.h:429
void insert(InputIt first, InputIt last)
Definition robin_set.h:235
bool contains(const Key &key) const
Definition robin_set.h:422
iterator mutable_iterator(const_iterator pos)
Definition robin_set.h:575
robin_set(std::initializer_list< value_type > init, size_type bucket_count, const Hash &hash, const Allocator &alloc)
Definition robin_set.h:180
bool contains(const K &key, std::size_t precalculated_hash) const
Definition robin_set.h:455
void clear() noexcept
Definition robin_set.h:219
size_type count(const Key &key, std::size_t precalculated_hash) const
Definition robin_set.h:319
size_type max_bucket_count() const
Definition robin_set.h:537
size_type size() const noexcept
Definition robin_set.h:213
hasher hash_function() const
Definition robin_set.h:565
float max_load_factor() const
Definition robin_set.h:545
std::pair< iterator, bool > insert(value_type &&value)
Definition robin_set.h:223
static robin_set deserialize(Deserializer &deserializer, bool hash_compatible=false)
Definition robin_set.h:638
Definition bhopscotch_map.h:38
Definition robin_hash.h:54