50#include <initializer_list>
52#include <unordered_set>
74 template<Type::SafeValue K,
class Hash = Hash<K>,
class KeyEqual = std::equal_to<K>>
254 bool empty() const noexcept {
return m_node.empty(); }
260 explicit operator bool() const noexcept {
return !
empty(); }
266 const K&
value()
const {
return m_node.key(); }
276 explicit node_type(
typename Storage::node_type node)
noexcept: m_node(std::move(node)) {}
277 typename Storage::node_type m_node;
351 template<class InputIt>
364 template<class InputIt>
390 for (
const K& value : other)
400 for (
const K& value : other)
517 template<class InputIt>
518 void insert(InputIt first, InputIt last);
533 template<
std::ranges::input_range R>
536 for (
auto&& value : range)
547 template<
class... Args>
558 template<
class... Args>
599 template<
class OtherHash,
class OtherEqual>
751 for (
const K& value : *
this)
752 exported.insert(value);
768 template<Type::SafeValue K,
class Hash,
class KeyEqual>
std::pair whose members keep their own Safe storage.
Definition pair.hxx:73
Unique-key hash map stored on Base's heap.
Definition unordered_map.hxx:80
BasicIterator< true > const_iterator
Definition unordered_map.hxx:177
BasicIterator< false > iterator
Definition unordered_map.hxx:176
Read-only forward cursor.
Definition unordered_set.hxx:148
std::forward_iterator_tag iterator_concept
C++20 iterator concept.
Definition unordered_set.hxx:151
const_iterator & operator++()
Advance to the next occupied node.
Definition unordered_set.hxx:185
const_iterator operator++(int)
Advance to the next occupied node.
Definition unordered_set.hxx:191
bool operator==(const const_iterator &other) const noexcept
Compare node identity.
Definition unordered_set.hxx:198
friend class UnorderedSet
Definition unordered_set.hxx:201
const K & reference
Reference to the value.
Definition unordered_set.hxx:155
std::ptrdiff_t difference_type
Iterator distance type.
Definition unordered_set.hxx:153
const K * pointer
Pointer to the value.
Definition unordered_set.hxx:154
K value_type
Stored value.
Definition unordered_set.hxx:152
pointer operator->() const
Return a pointer to the value.
Definition unordered_set.hxx:179
void StormByteSafeCursor
Base cursor mark. Copying the cursor copies one node pointer.
Definition unordered_set.hxx:156
std::forward_iterator_tag iterator_category
Iterator category.
Definition unordered_set.hxx:150
const_iterator() noexcept=default
Construct a singular iterator.
reference operator*() const
Return the value.
Definition unordered_set.hxx:173
Forward cursor.
Definition unordered_set.hxx:92
const K & reference
Reference to the value.
Definition unordered_set.hxx:99
iterator operator++(int)
Advance to the next occupied node.
Definition unordered_set.hxx:129
std::ptrdiff_t difference_type
Iterator distance type.
Definition unordered_set.hxx:97
friend class UnorderedSet
Definition unordered_set.hxx:139
void StormByteSafeCursor
Base cursor mark. Copying the cursor copies one node pointer.
Definition unordered_set.hxx:100
const K * pointer
Pointer to the value.
Definition unordered_set.hxx:98
std::forward_iterator_tag iterator_category
Iterator category.
Definition unordered_set.hxx:94
bool operator==(const iterator &other) const noexcept
Compare node identity.
Definition unordered_set.hxx:136
iterator() noexcept=default
Construct a singular iterator.
std::forward_iterator_tag iterator_concept
C++20 iterator concept.
Definition unordered_set.hxx:95
iterator & operator++()
Advance to the next occupied node.
Definition unordered_set.hxx:123
pointer operator->() const
Return a pointer to the value.
Definition unordered_set.hxx:117
K value_type
Stored value.
Definition unordered_set.hxx:96
Owning handle to one extracted Base node.
Definition unordered_set.hxx:214
bool empty() const noexcept
Test whether the handle owns a node.
Definition unordered_set.hxx:254
friend class UnorderedSet
Definition unordered_set.hxx:275
node_type() noexcept=default
Construct an empty handle.
void swap(node_type &other) noexcept
Exchange owned nodes.
Definition unordered_set.hxx:272
const K & value() const
Return the owned value.
Definition unordered_set.hxx:266
Unique values stored in a Base-heap hash table.
Definition unordered_set.hxx:75
key_equal key_eq() const
Return the stored equality predicate.
void rehash(size_type buckets)
Replace the bucket array.
size_type size() const noexcept
Return the number of values.
iterator emplace_hint(const_iterator hint, Args &&... args)
Construct a value.
iterator erase(const_iterator position)
Erase the value at a read-only iterator.
void swap(UnorderedSet &other) noexcept
Exchange tables.
insert_result emplace(Args &&... args)
Construct a value in a new node if it is absent.
size_type max_size() const noexcept
Return the maximum number of values.
STORMBYTE_FORCE_INLINE UnorderedSet(std::unordered_set< K > &&other)
Move values from a caller-owned STL set and leave it empty.
Definition unordered_set.hxx:399
const_iterator find(const K &value) const
Find a value.
size_type count(const K &value) const
Count matching values.
size_type erase(const K &value)
Erase a value.
iterator erase(const_iterator first, const_iterator last)
Erase [first, last).
iterator find(const K &value)
Find a value.
size_type bucket_count() const noexcept
Return the bucket count.
Pair< iterator, bool > insert_result
Iterator to the value and whether it was inserted.
Definition unordered_set.hxx:206
UnorderedSet() noexcept
Construct an empty set.
size_type bucket(const K &value) const
Return the bucket of value.
bool empty() const noexcept
Test whether the set has no values.
node_type extract(const K &value)
Unlink value and return that node.
insert_return_type insert(node_type &&handle)
Insert an extracted node if its value is absent.
iterator insert(const_iterator hint, node_type &&handle)
Insert an extracted node.
const K & const_reference
Read-only value reference.
Definition unordered_set.hxx:86
void reserve(size_type count)
Reserve room for count values without exceeding the load factor.
const K & reference
Read-only value reference.
Definition unordered_set.hxx:85
float max_load_factor() const noexcept
Return the load factor that triggers a rehash.
Size size_type
Element count. Size, not std::size_t.
Definition unordered_set.hxx:83
size_type bucket_size(size_type index) const
Return the number of values in index.
std::ptrdiff_t difference_type
Iterator distance type.
Definition unordered_set.hxx:84
KeyEqual key_equal
Value equality.
Definition unordered_set.hxx:82
node_type extract(const_iterator position)
Unlink the value at position and return that node.
STORMBYTE_FORCE_INLINE void insert_range(R &&range)
Insert a copy of range.
Definition unordered_set.hxx:535
iterator end() noexcept
Return the past-the-end iterator.
Hash hasher
Value hash.
Definition unordered_set.hxx:81
Pair< iterator, iterator > equal_range(const K &value)
Return the range of values equal to value.
void clear() noexcept
Destroy every value.
float load_factor() const noexcept
Return the current load factor.
iterator erase(iterator position)
Erase the value at an iterator.
insert_result insert(const K &value)
Insert a value if it is absent.
iterator begin() noexcept
Return an iterator to the first occupied node.
const_iterator cbegin() const noexcept
Return an iterator to the first occupied node.
Pair< const_iterator, const_iterator > equal_range(const K &value) const
Return the range of values equal to value.
K key_type
Value and lookup type.
Definition unordered_set.hxx:79
K value_type
Stored value.
Definition unordered_set.hxx:80
const_iterator cend() const noexcept
Return the past-the-end iterator.
bool contains(const K &value) const
Test whether a value is present.
hasher hash_function() const
Return the stored hash.
void merge(UnorderedSet< K, OtherHash, OtherEqual > &source)
Take unique values from source.
Count of abstract units (uint64_t storage).
Definition size.hxx:107
Owned values that cross a DLL without the caller's CRT.
void swap(Binary &left, Binary &right) noexcept
Exchange two sequences.
Definition binary.hxx:760
Root namespace of the StormByte suite.
Cross-module hash.
Definition hash.hxx:95
Result of inserting an extracted node.
Definition unordered_set.hxx:283
iterator position
Value, or end when the node was not inserted and is empty.
Definition unordered_set.hxx:284
bool inserted
Whether the node was linked.
Definition unordered_set.hxx:285
node_type node
Returned node when the value was already present.
Definition unordered_set.hxx:286
#define STORMBYTE_PUBLIC_TYPE
Definition visibility.h:57
#define STORMBYTE_PUBLIC
Definition visibility.h:52