4#ifndef GREM_CORE_DATA_HASH_SET_HPP
5#define GREM_CORE_DATA_HASH_SET_HPP
18#include <initializer_list>
22#include <memory_resource>
29template <
typename Key,
typename Hash = std::hash<Key>,
typename KeyEqual = std::equal_to<Key>,
typename Allocator = std::allocator<Key>>
32 static constexpr bool IS_TRANSPARENT =
requires {
33 typename Hash::is_transparent;
34 typename KeyEqual::is_transparent;
42 using pointer =
typename std::allocator_traits<Allocator>::pointer;
43 using const_pointer =
typename std::allocator_traits<Allocator>::const_pointer;
67 return set->keys[index];
77 index = set->findActiveIndexUnbounded(index + 1);
91 index = set->findActiveIndexReverseUnbounded(index - 1);
103 return index == other.index;
121 constexpr explicit
HashSet(
size_type bucket_count, const Hash& hash = Hash(), const KeyEqual& equal = KeyEqual(), const Allocator& allocator = Allocator())
122 :
HashSet(hash, equal, allocator) {
127 :
HashSet(bucket_count, Hash(), KeyEqual(), allocator) {}
130 :
HashSet(bucket_count, hash, KeyEqual(), allocator) {}
132 constexpr explicit HashSet(
const Allocator& allocator)
133 :
HashSet(Hash(), KeyEqual(), allocator) {}
135 template <std::input_iterator InputIterator, std::sentinel_for<InputIterator> Sentinel>
136 constexpr HashSet(InputIterator first, Sentinel last,
size_type bucket_count = 0,
const Hash& hash = Hash(),
const KeyEqual& equal = KeyEqual(),
137 const Allocator& allocator = Allocator())
138 :
HashSet(bucket_count, hash, equal, allocator) {
142 template <std::input_iterator InputIterator, std::sentinel_for<InputIterator> Sentinel>
143 constexpr HashSet(InputIterator first, Sentinel last,
size_type bucket_count,
const Allocator& allocator)
144 :
HashSet(first, last, bucket_count, Hash(), KeyEqual(), allocator) {}
146 template <std::input_iterator InputIterator, std::sentinel_for<InputIterator> Sentinel>
147 constexpr HashSet(InputIterator first, Sentinel last,
size_type bucket_count,
const Hash& hash,
const Allocator& allocator)
148 :
HashSet(first, last, bucket_count, hash, KeyEqual(), allocator) {}
150 constexpr HashSet(std::initializer_list<value_type> ilist,
size_type bucket_count = 0,
const Hash& hash = Hash(),
const KeyEqual& equal = KeyEqual(),
151 const Allocator& allocator = Allocator())
152 :
HashSet(ilist.
begin(), ilist.
end(), bucket_count, hash, equal, allocator) {}
154 constexpr HashSet(std::initializer_list<value_type> ilist,
size_type bucket_count,
const Allocator& allocator = Allocator())
155 :
HashSet(ilist, bucket_count, Hash(), KeyEqual(), allocator) {}
157 constexpr HashSet(std::initializer_list<value_type> ilist,
size_type bucket_count,
const Hash& hash = Hash(),
const Allocator& allocator = Allocator())
158 :
HashSet(ilist, bucket_count, hash, KeyEqual(), allocator) {}
161 :
HashSet(other, std::allocator_traits<Allocator>::select_on_container_copy_construction(other.
get_allocator())) {}
169 : activeBits(std::exchange(other.activeBits,
nullptr))
170 , bucketExtents(std::exchange(other.bucketExtents,
nullptr))
171 , keys(std::exchange(other.keys,
nullptr))
172 , elementCount(std::exchange(other.elementCount,
size_type{0}))
173 , elementCapacity(std::exchange(other.elementCapacity,
size_type{0}))
174 , hash(std::move(other.hash))
175 , equal(std::move(other.equal))
176 , allocator(other.get_allocator()) {}
180 if constexpr (!std::allocator_traits<Allocator>::is_always_equal::value) {
181 if (allocator != other.get_allocator()) {
184 if constexpr (std::is_nothrow_move_constructible_v<Key>) {
185 insert(std::move(
const_cast<Key&
>(element)));
194 activeBits = std::exchange(other.activeBits,
nullptr);
195 bucketExtents = std::exchange(other.bucketExtents,
nullptr);
196 keys = std::exchange(other.keys,
nullptr);
197 elementCount = std::exchange(other.elementCount,
size_type{0});
198 elementCapacity = std::exchange(other.elementCapacity,
size_type{0});
199 hash = std::move(other.hash);
200 equal = std::move(other.equal);
208 if (
this == &other) {
211 if constexpr (std::allocator_traits<Allocator>::propagate_on_container_copy_assignment::value) {
212 if constexpr (!std::allocator_traits<Allocator>::is_always_equal::value) {
220 if (elementCapacity == other.elementCapacity) {
221 if (other.elementCount > 0) {
225 for (
size_type index =
begin; index < elementCapacity; index = other.findActiveIndexUnbounded(index + 1)) {
227 std::allocator_traits<Allocator>::construct(allocator, std::to_address(keys) + index, other.keys[index]);
229 while (index !=
begin) {
230 index = other.findActiveIndexReverseUnbounded(index - 1);
231 std::allocator_traits<Allocator>::destroy(allocator, std::to_address(keys) + index);
236 std::memcpy(std::to_address(activeBits), std::to_address(other.activeBits), (elementCapacity / 64) *
sizeof(std::uint64_t));
237 std::memcpy(std::to_address(bucketExtents), std::to_address(other.bucketExtents), elementCapacity *
sizeof(std::uint32_t));
238 elementCount = other.elementCount;
249 if (
this == &other) {
252 if constexpr (!std::allocator_traits<Allocator>::propagate_on_container_move_assignment::value) {
253 if constexpr (!std::allocator_traits<Allocator>::is_always_equal::value) {
254 if (allocator != other.get_allocator()) {
257 for (
const Key& element : other) {
258 if constexpr (std::is_nothrow_move_constructible_v<Key>) {
259 insert(std::move(
const_cast<Key&
>(element)));
270 activeBits = std::exchange(other.activeBits,
nullptr);
271 bucketExtents = std::exchange(other.bucketExtents,
nullptr);
272 keys = std::exchange(other.keys,
nullptr);
273 elementCount = std::exchange(other.elementCount,
size_type{0});
274 elementCapacity = std::exchange(other.elementCapacity,
size_type{0});
275 hash = std::move(other.hash);
276 equal = std::move(other.equal);
277 if constexpr (std::allocator_traits<Allocator>::propagate_on_container_move_assignment::value) {
278 allocator = other.get_allocator();
289 constexpr void swap(
HashSet& other)
noexcept(std::allocator_traits<Allocator>::is_always_equal::value) {
290 if (
this == &other) {
294 swap(activeBits, other.activeBits);
295 swap(bucketExtents, other.bucketExtents);
296 swap(keys, other.keys);
297 swap(elementCount, other.elementCount);
298 swap(elementCapacity, other.elementCapacity);
299 swap(hash, other.hash);
300 swap(equal, other.equal);
301 if constexpr (std::allocator_traits<Allocator>::propagate_on_container_swap::value) {
302 swap(allocator, other.allocator);
303 }
else if constexpr (!std::allocator_traits<Allocator>::is_always_equal::value) {
313 if (elementCount > 0) {
316 for (
size_type index = findActiveIndexUnbounded(0); index < elementCapacity; index = findActiveIndexUnbounded(index + 1)) {
317 std::allocator_traits<Allocator>::destroy(allocator, std::to_address(keys) + index);
319 std::memset(std::to_address(activeBits), 0, (elementCapacity / 64) *
sizeof(std::uint64_t));
320 std::memset(std::to_address(bucketExtents), 0, elementCapacity *
sizeof(std::uint32_t));
327 while (
static_cast<float>(capacity) >
static_cast<float>(newCapacity) * MAX_SIZE_PER_CAPACITY) {
328 if (newCapacity >= std::numeric_limits<size_type>::max() / 2) {
329 throw std::length_error{
"Maximum capacity exceeded."};
333 if (newCapacity <= elementCapacity) {
338 GREM_ASSERT((newCapacity & (newCapacity - 1)) == 0);
340 HashSet newSet{hash, equal, allocator};
341 UInt64Allocator uInt64Allocator = allocator;
342 UInt32Allocator uInt32Allocator = allocator;
343 newSet.activeBits = std::allocator_traits<UInt64Allocator>::allocate(uInt64Allocator, newCapacity / 64 + 1);
345 newSet.bucketExtents = std::allocator_traits<UInt32Allocator>::allocate(uInt32Allocator, newCapacity);
347 newSet.keys = std::allocator_traits<Allocator>::allocate(allocator, newCapacity);
349 std::allocator_traits<UInt32Allocator>::deallocate(uInt32Allocator, newSet.bucketExtents, newCapacity);
353 std::allocator_traits<UInt64Allocator>::deallocate(uInt64Allocator, newSet.activeBits, newCapacity / 64 + 1);
356 std::memset(std::to_address(newSet.activeBits), 0, (newCapacity / 64) *
sizeof(std::uint64_t));
357 newSet.activeBits[newCapacity / 64] = 1;
358 std::memset(std::to_address(newSet.bucketExtents), 0, newCapacity *
sizeof(std::uint32_t));
359 newSet.elementCapacity = newCapacity;
361 for (
const Key& element : *
this) {
362 if constexpr (std::is_nothrow_move_constructible_v<Key>) {
363 newSet.
insert(std::move(
const_cast<Key&
>(element)));
369 *
this = std::move(newSet);
377 return insertKey(std::move(value));
380 template <
typename P>
382 return insertKey(
value_type(std::forward<P>(value)));
385 template <std::input_iterator InputIterator, std::sentinel_for<InputIterator> Sentinel>
386 constexpr void insert(InputIterator first, Sentinel last) {
387 if constexpr (std::is_convertible_v<typename std::iterator_traits<InputIterator>::iterator_category, std::random_access_iterator_tag>) {
390 while (first != last) {
395 constexpr void insert(std::initializer_list<value_type> ilist) {
396 insert(ilist.begin(), ilist.end());
399 template <
typename R>
401 insert(std::begin(r), std::end(r));
404 template <
typename... Args>
406 return insertKey(
value_type(std::forward<Args>(args)...));
410 return iterator{
this, eraseAtIndex(pos.index)};
414 while (first != last) {
415 first =
erase(first);
417 return iterator{
this, first.index};
421 return eraseKey(key);
424 template <
typename K>
425 constexpr size_type erase(K&& x)
requires(IS_TRANSPARENT && !std::is_convertible_v<K, iterator> && !std::is_convertible_v<K, const_iterator>) {
426 return eraseKey(std::forward<K>(x));
429 template <
typename Predicate>
432 iterator it = c.
begin();
433 while (it != c.
end()) {
434 if (predicate(*it)) {
440 return oldSize - c.
size();
455 [[nodiscard]]
constexpr bool empty() const noexcept {
456 return elementCount == 0;
464 static_assert(MAX_SIZE_PER_CAPACITY <= 1.0f);
466 static_cast<float>(std::min({
467 static_cast<size_type>(std::numeric_limits<difference_type>::max()),
468 static_cast<size_type>(std::numeric_limits<size_type>::max() /
sizeof(std::uint32_t)),
469 static_cast<size_type>(std::numeric_limits<size_type>::max() /
sizeof(Key)),
470 static_cast<size_type>(std::allocator_traits<UInt32Allocator>::max_size(allocator)),
471 static_cast<size_type>(std::allocator_traits<Allocator>::max_size(allocator)),
473 MAX_SIZE_PER_CAPACITY);
476 [[nodiscard]]
constexpr bool contains(
const Key& key)
const {
480 template <
typename K>
481 [[nodiscard]]
constexpr bool contains(
const K& x)
const requires(IS_TRANSPARENT) {
489 template <
typename K>
490 [[nodiscard]]
constexpr size_type count(
const K& x)
const requires(IS_TRANSPARENT) {
494 [[nodiscard]]
constexpr iterator
find(
const Key& key) {
495 return iterator{
this, findIndex(key)};
502 template <
typename K>
503 [[nodiscard]]
constexpr iterator
find(
const K& x)
requires(IS_TRANSPARENT) {
504 return iterator{
this, findIndex(x)};
507 template <
typename K>
514 return iterator{
this, index};
525 return *iterator{
this, index};
535 const iterator it =
find(key);
537 return {it, std::next(it)};
545 return {it, std::next(it)};
550 template <
typename K>
552 const iterator it =
find(x);
554 return {it, std::next(it)};
559 template <
typename K>
563 return {it, std::next(it)};
568 [[nodiscard]]
constexpr iterator
begin() noexcept {
569 return iterator{
this, (elementCount > 0) ? findActiveIndexUnbounded(0) : elementCapacity};
573 return const_iterator{
this, (elementCount > 0) ? findActiveIndexUnbounded(0) : elementCapacity};
580 [[nodiscard]]
constexpr iterator
end() noexcept {
581 return iterator{
this, elementCapacity};
597 return std::lexicographical_compare(
begin(),
end(), other.
begin(), other.
end());
601 return !(other < *
this);
605 return other < *
this;
609 return !(*
this < other);
613 static constexpr float MAX_SIZE_PER_CAPACITY = 0.7f;
615 using UInt64Allocator =
typename std::allocator_traits<Allocator>::template rebind_alloc<std::uint64_t>;
616 using UInt32Allocator =
typename std::allocator_traits<Allocator>::template rebind_alloc<std::uint32_t>;
618 constexpr HashSet(
const Hash& hash,
const KeyEqual&
equal,
const Allocator& allocator)
621 , allocator(allocator) {}
623 [[nodiscard]]
constexpr size_type getBucketIndexOfHash(std::size_t hashCode)
const noexcept {
624 GREM_ASSERT((elementCapacity & (elementCapacity - 1)) == 0);
625 return static_cast<size_type>(hashCode) &
static_cast<size_type>(elementCapacity - 1);
630 GREM_ASSERT((elementCapacity & (elementCapacity - 1)) == 0);
631 return index &
static_cast<size_type>(elementCapacity - 1);
634 [[nodiscard]]
constexpr bool isActive(
size_type index)
const {
635 return (activeBits[index / 64] & (std::uint64_t{1} << (index % 64))) != 0;
638 constexpr void setActive(
size_type index) {
639 activeBits[index / 64] |= std::uint64_t{1} << (index % 64);
642 constexpr void clearActive(
size_type index) {
643 activeBits[index / 64] &= ~(std::uint64_t{1} << (index % 64));
648 const std::uint64_t bitsIndex = index / 64;
649 const std::uint64_t bitOffset = index % 64;
650 const std::uint64_t bits = activeBits[bitsIndex] >> bitOffset;
652 index +=
static_cast<size_type>(std::countr_zero(bits));
655 index += 64 - bitOffset;
660 [[nodiscard]]
constexpr size_type findActiveIndexReverseUnbounded(
size_type index)
const {
662 const std::uint64_t bitsIndex = index / 64;
663 const std::uint64_t bitOffset = index % 64;
664 const std::uint64_t bits = activeBits[bitsIndex] << (63 - bitOffset);
666 index -=
static_cast<size_type>(std::countl_zero(bits));
669 index -= bitOffset + 1;
674 constexpr void reset() noexcept {
676 if (elementCapacity > 0) {
677 UInt64Allocator uInt64Allocator = allocator;
678 UInt32Allocator uInt32Allocator = allocator;
679 std::allocator_traits<UInt64Allocator>::deallocate(uInt64Allocator, activeBits, (elementCapacity / 64) + 1);
680 std::allocator_traits<UInt32Allocator>::deallocate(uInt32Allocator, bucketExtents, elementCapacity);
681 std::allocator_traits<Allocator>::deallocate(allocator, keys, elementCapacity);
682 activeBits =
nullptr;
683 bucketExtents =
nullptr;
691 throw std::length_error{
"size() >= max_size()"};
696 const size_type bucketBegin = getBucketIndexOfHash(hash(k));
697 const size_type bucketExtent = bucketExtents[bucketBegin];
698 const size_type bucketEnd = getWrappedIndex(bucketBegin + bucketExtent);
699 for (
size_type index = bucketBegin; index != bucketEnd; index = getWrappedIndex(index + 1)) {
700 if (isActive(index) && equal(keys[index], k)) {
701 return {
iterator{
this, index},
false};
706 while (isActive(index)) {
707 index = getWrappedIndex(index + 1);
708 if (newBucketExtent >=
size_type{std::numeric_limits<std::uint32_t>::max()}) {
709 throw std::length_error{
"Maximum bucket size exceeded."};
714 std::allocator_traits<Allocator>::construct(allocator, std::to_address(keys) + index, std::move(k));
716 if (newBucketExtent > bucketExtent) {
717 bucketExtents[bucketBegin] =
static_cast<std::uint32_t
>(newBucketExtent);
722 return {
iterator{
this, index},
true};
729 const size_type bucketBegin = getBucketIndexOfHash(hash(keys[index]));
730 size_type bucketExtent = bucketExtents[bucketBegin];
731 size_type bucketEnd = getWrappedIndex(bucketBegin + bucketExtent);
736 std::allocator_traits<Allocator>::destroy(allocator, std::to_address(keys) + index);
740 if (getWrappedIndex(index + 1) == bucketEnd) {
743 while (bucketExtent > 0) {
744 const size_type previousIndex = getWrappedIndex(bucketEnd - 1);
745 if (isActive(previousIndex)) {
749 bucketEnd = previousIndex;
751 bucketExtents[bucketBegin] =
static_cast<std::uint32_t
>(bucketExtent);
754 return findActiveIndexUnbounded(index + 1);
757 template <
typename K>
758 [[nodiscard]]
size_type eraseKey(
const K& k) {
763 const size_type bucketBegin = getBucketIndexOfHash(hash(k));
764 size_type bucketExtent = bucketExtents[bucketBegin];
765 size_type bucketEnd = getWrappedIndex(bucketBegin + bucketExtent);
767 while (index != bucketEnd && (!isActive(index) || !equal(keys[index], k))) {
768 index = getWrappedIndex(index + 1);
770 if (index == bucketEnd) {
777 std::allocator_traits<Allocator>::destroy(allocator, std::to_address(keys) + index);
781 if (getWrappedIndex(index + 1) == bucketEnd) {
784 while (bucketExtent > 0) {
785 const size_type previousIndex = getWrappedIndex(bucketEnd - 1);
786 if (isActive(previousIndex)) {
790 bucketEnd = previousIndex;
792 bucketExtents[bucketBegin] =
static_cast<std::uint32_t
>(bucketExtent);
798 template <
typename K>
799 [[nodiscard]]
size_type findIndex(
const K& k)
const {
801 const size_type bucketBegin = getBucketIndexOfHash(hash(k));
802 const size_type bucketExtent = bucketExtents[bucketBegin];
803 const size_type bucketEnd = getWrappedIndex(bucketBegin + bucketExtent);
805 while (index != bucketEnd && (!isActive(index) || !equal(keys[index], k))) {
806 index = getWrappedIndex(index + 1);
808 if (index != bucketEnd) {
812 return elementCapacity;
815 typename std::allocator_traits<UInt64Allocator>::pointer activeBits{};
816 typename std::allocator_traits<UInt32Allocator>::pointer bucketExtents{};
817 typename std::allocator_traits<Allocator>::pointer keys{};
820 [[no_unique_address]]
hasher hash;
822 [[no_unique_address]] Allocator allocator;
829template <
typename Key,
typename Hash = std::hash<Key>,
typename KeyEqual = std::equal_to<Key>>
#define GREM_ASSERT(expression)
Definition assertions.hpp:77
Definition HashSet.hpp:50
constexpr iterator & operator--()
Definition HashSet.hpp:87
constexpr iterator operator++(int)
Definition HashSet.hpp:81
constexpr size_type getIndex() const noexcept
Definition HashSet.hpp:106
std::bidirectional_iterator_tag iterator_category
Definition HashSet.hpp:56
constexpr iterator operator--(int)
Definition HashSet.hpp:95
constexpr reference operator*() const
Definition HashSet.hpp:64
constexpr pointer operator->() const
Definition HashSet.hpp:70
Key value_type
Definition HashSet.hpp:52
constexpr bool operator==(const iterator &other) const noexcept
Definition HashSet.hpp:101
constexpr iterator & operator++()
Definition HashSet.hpp:74
std::ptrdiff_t difference_type
Definition HashSet.hpp:55
iterator() noexcept=default
const Key & reference
Definition HashSet.hpp:53
Definition HashSet.hpp:30
constexpr bool operator>(const HashSet &other) const
Definition HashSet.hpp:604
friend constexpr void swap(HashSet &a, HashSet &b) noexcept(noexcept(a.swap(b)))
Definition HashSet.hpp:308
constexpr HashSet(const HashSet &other, const Allocator &allocator)
Definition HashSet.hpp:163
constexpr Pair< iterator, bool > insert(P &&value)
Definition HashSet.hpp:381
constexpr iterator getIteratorAtIndex(size_type index)
Definition HashSet.hpp:512
friend constexpr size_type erase_if(HashSet &c, Predicate predicate)
Definition HashSet.hpp:430
constexpr HashSet(size_type bucket_count, const Hash &hash, const Allocator &allocator)
Definition HashSet.hpp:129
constexpr HashSet(InputIterator first, Sentinel last, size_type bucket_count=0, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &allocator=Allocator())
Definition HashSet.hpp:136
constexpr HashSet & operator=(std::initializer_list< value_type > ilist)
Definition HashSet.hpp:283
constexpr const_reference getAtIndex(size_type index) const
Definition HashSet.hpp:528
constexpr iterator find(const K &x)
Definition HashSet.hpp:503
constexpr iterator end() noexcept
Definition HashSet.hpp:580
constexpr const_iterator cbegin() const noexcept
Definition HashSet.hpp:576
constexpr ~HashSet()
Definition HashSet.hpp:203
constexpr Pair< iterator, bool > insert(const value_type &value)
Definition HashSet.hpp:372
constexpr iterator erase(const_iterator pos)
Definition HashSet.hpp:409
constexpr void swap(HashSet &other) noexcept(std::allocator_traits< Allocator >::is_always_equal::value)
Definition HashSet.hpp:289
constexpr size_type erase(const Key &key)
Definition HashSet.hpp:420
constexpr const_iterator begin() const noexcept
Definition HashSet.hpp:572
constexpr iterator erase(const_iterator first, const_iterator last)
Definition HashSet.hpp:413
Key value_type
Definition HashSet.hpp:39
constexpr allocator_type get_allocator() const noexcept
Definition HashSet.hpp:451
constexpr bool contains(const K &x) const
Definition HashSet.hpp:481
typename std::allocator_traits< Allocator >::const_pointer const_pointer
Definition HashSet.hpp:43
const Key & const_reference
Definition HashSet.hpp:41
constexpr size_type count(const Key &key) const
Definition HashSet.hpp:485
std::ptrdiff_t difference_type
Definition HashSet.hpp:44
constexpr size_type count(const K &x) const
Definition HashSet.hpp:490
constexpr HashSet(std::initializer_list< value_type > ilist, size_type bucket_count, const Allocator &allocator=Allocator())
Definition HashSet.hpp:154
constexpr bool operator>=(const HashSet &other) const
Definition HashSet.hpp:608
Key & reference
Definition HashSet.hpp:40
iterator const_iterator
Definition HashSet.hpp:117
constexpr bool operator<=(const HashSet &other) const
Definition HashSet.hpp:600
constexpr HashSet(std::initializer_list< value_type > ilist, size_type bucket_count, const Hash &hash=Hash(), const Allocator &allocator=Allocator())
Definition HashSet.hpp:157
constexpr void clear() noexcept
Definition HashSet.hpp:312
constexpr iterator find(const Key &key)
Definition HashSet.hpp:494
constexpr iterator begin() noexcept
Definition HashSet.hpp:568
constexpr hasher hash_function() const
Definition HashSet.hpp:443
Allocator allocator_type
Definition HashSet.hpp:48
constexpr const_iterator getIteratorAtIndex(size_type index) const
Definition HashSet.hpp:517
constexpr const_iterator find(const Key &key) const
Definition HashSet.hpp:498
constexpr Pair< const_iterator, const_iterator > equal_range(const Key &key) const
Definition HashSet.hpp:542
constexpr bool operator<(const HashSet &other) const
Definition HashSet.hpp:596
constexpr void insert(InputIterator first, Sentinel last)
Definition HashSet.hpp:386
constexpr Pair< iterator, bool > emplace(Args &&... args)
Definition HashSet.hpp:405
constexpr HashSet(const HashSet &other)
Definition HashSet.hpp:160
constexpr void reserve(size_type capacity)
Definition HashSet.hpp:325
constexpr Pair< iterator, iterator > equal_range(const K &x)
Definition HashSet.hpp:551
constexpr reference getAtIndex(size_type index)
Definition HashSet.hpp:522
constexpr HashSet & operator=(const HashSet &other)
Definition HashSet.hpp:207
constexpr size_type erase(K &&x)
Definition HashSet.hpp:425
constexpr HashSet(InputIterator first, Sentinel last, size_type bucket_count, const Hash &hash, const Allocator &allocator)
Definition HashSet.hpp:147
constexpr HashSet(const Allocator &allocator)
Definition HashSet.hpp:132
constexpr Pair< iterator, iterator > equal_range(const Key &key)
Definition HashSet.hpp:534
Hash hasher
Definition HashSet.hpp:46
constexpr const_iterator end() const noexcept
Definition HashSet.hpp:584
std::size_t size_type
Definition HashSet.hpp:45
constexpr HashSet(InputIterator first, Sentinel last, size_type bucket_count, const Allocator &allocator)
Definition HashSet.hpp:143
constexpr HashSet(HashSet &&other, const Allocator &allocator) noexcept
Definition HashSet.hpp:178
constexpr HashSet(std::initializer_list< value_type > ilist, size_type bucket_count=0, const Hash &hash=Hash(), const KeyEqual &equal=KeyEqual(), const Allocator &allocator=Allocator())
Definition HashSet.hpp:150
constexpr const_iterator find(const K &x) const
Definition HashSet.hpp:508
constexpr Pair< iterator, bool > insert(value_type &&value)
Definition HashSet.hpp:376
constexpr bool contains(const Key &key) const
Definition HashSet.hpp:476
constexpr HashSet(HashSet &&other) noexcept
Definition HashSet.hpp:168
constexpr size_type max_size() const noexcept
Definition HashSet.hpp:463
constexpr const_iterator cend() const noexcept
Definition HashSet.hpp:588
constexpr HashSet(size_type bucket_count, const Allocator &allocator)
Definition HashSet.hpp:126
constexpr bool empty() const noexcept
Definition HashSet.hpp:455
KeyEqual key_equal
Definition HashSet.hpp:47
Key key_type
Definition HashSet.hpp:38
constexpr size_type size() const noexcept
Definition HashSet.hpp:459
constexpr HashSet & operator=(HashSet &&other) noexcept
Definition HashSet.hpp:248
constexpr void insert(std::initializer_list< value_type > ilist)
Definition HashSet.hpp:395
constexpr bool operator==(const HashSet &other) const
Definition HashSet.hpp:592
constexpr HashSet() noexcept=default
constexpr Pair< const_iterator, const_iterator > equal_range(const K &x) const
Definition HashSet.hpp:560
constexpr key_equal key_eq() const
Definition HashSet.hpp:447
constexpr void insert_range(R &&r)
Definition HashSet.hpp:400
Definition concepts.hpp:106
Definition Allocation.hpp:554
grem::HashSet< Key, Hash, KeyEqual, std::pmr::polymorphic_allocator< Key > > HashSet
Definition HashSet.hpp:830
constexpr bool equal(input_range auto &&rangeA, input_range auto &&rangeB)
Definition algorithms.hpp:358
Pair(T1, T2) -> Pair< T1, T2 >