50#include <initializer_list>
73 template<Type::SafeValue K,
class Compare = std::less<K>>
74 requires std::strict_weak_order<Compare, const K&, const K&>
280 bool empty() const noexcept {
return m_node.empty(); }
286 explicit operator bool() const noexcept {
return !
empty(); }
292 const K&
value()
const {
return m_node.key(); }
302 explicit node_type(
typename Storage::node_type node)
noexcept: m_node(std::move(node)) {}
303 typename Storage::node_type m_node;
324 explicit Set(
const Compare& compare);
374 template<
class InputIt>
375 Set(InputIt first, InputIt last);
385 template<
class InputIt>
386 Set(InputIt first, InputIt last,
const Compare& compare);
393 Set(std::initializer_list<K> values);
401 Set(std::initializer_list<K> values,
const Compare& compare);
551 template<class InputIt>
552 void insert(InputIt first, InputIt last);
567 template<
std::ranges::input_range R>
570 for (
auto&& value : range)
581 template<
class... Args>
592 template<
class... Args>
630 template<
class OtherCompare>
785 std::set<K, Compare> exported(
key_comp());
786 for (
const K& value : *
this)
787 exported.insert(value);
802 template<Type::SafeValue K,
class Compare>
Ordered unique-key map stored on Base's heap.
Definition map.hxx:78
BasicIterator< true > const_iterator
Definition map.hxx:211
BasicIterator< false > iterator
Definition map.hxx:210
std::pair whose members keep their own Safe storage.
Definition pair.hxx:73
Read-only bidirectional cursor.
Definition set.hxx:160
const K & reference
Reference to the key.
Definition set.hxx:167
std::bidirectional_iterator_tag iterator_category
Iterator category.
Definition set.hxx:162
reference operator*() const
Return the key.
Definition set.hxx:185
const_iterator operator--(int)
Move to the previous key.
Definition set.hxx:215
std::ptrdiff_t difference_type
Iterator distance type.
Definition set.hxx:165
K value_type
Stored value.
Definition set.hxx:164
const_iterator & operator++()
Advance to the next key.
Definition set.hxx:197
const_iterator() noexcept=default
Construct a singular iterator.
pointer operator->() const
Return a pointer to the key.
Definition set.hxx:191
const_iterator & operator--()
Move to the previous key.
Definition set.hxx:209
friend class Set
Definition set.hxx:225
void StormByteSafeCursor
Base cursor mark. Copying the cursor copies one node pointer.
Definition set.hxx:168
const_iterator operator++(int)
Advance to the next key.
Definition set.hxx:203
const K * pointer
Pointer to the key.
Definition set.hxx:166
bool operator==(const const_iterator &other) const noexcept
Compare node identity.
Definition set.hxx:222
std::bidirectional_iterator_tag iterator_concept
C++20 iterator concept.
Definition set.hxx:163
Bidirectional cursor.
Definition set.hxx:92
const K * pointer
Pointer to the key.
Definition set.hxx:98
pointer operator->() const
Return a pointer to the key.
Definition set.hxx:117
std::bidirectional_iterator_tag iterator_concept
C++20 iterator concept.
Definition set.hxx:95
iterator & operator--()
Move to the previous key.
Definition set.hxx:135
bool operator==(const iterator &other) const noexcept
Compare node identity.
Definition set.hxx:148
void StormByteSafeCursor
Base cursor mark. Copying the cursor copies one node pointer.
Definition set.hxx:100
friend class Set
Definition set.hxx:151
K value_type
Stored value.
Definition set.hxx:96
std::bidirectional_iterator_tag iterator_category
Iterator category.
Definition set.hxx:94
iterator operator++(int)
Advance to the next key.
Definition set.hxx:129
iterator & operator++()
Advance to the next key.
Definition set.hxx:123
iterator operator--(int)
Move to the previous key.
Definition set.hxx:141
const K & reference
Reference to the key.
Definition set.hxx:99
iterator() noexcept=default
Construct a singular iterator.
std::ptrdiff_t difference_type
Iterator distance type.
Definition set.hxx:97
Owning handle to one extracted Base node.
Definition set.hxx:240
friend class Set
Definition set.hxx:301
void swap(node_type &other) noexcept
Exchange owned nodes.
Definition set.hxx:298
node_type() noexcept=default
Construct an empty handle.
const K & value() const
Return the owned value.
Definition set.hxx:292
bool empty() const noexcept
Test whether the handle owns a node.
Definition set.hxx:280
Ordered unique values stored on Base's heap.
Definition set.hxx:75
node_type extract(const K &value)
Unlink value and return that node.
K key_type
Value and lookup type.
Definition set.hxx:79
iterator upper_bound(const K &value)
Return the first value greater than value.
reverse_iterator rbegin() noexcept
Return a reverse iterator to the last value.
iterator insert(const_iterator hint, node_type &&handle)
Insert an extracted node, using hint when the neighbours confirm it.
size_type count(const K &value) const
Count matching values.
bool operator<(const Set &other) const
Compare lexicographically.
Set & operator=(const Set &other)
Copy-assign the values.
iterator find(const K &value)
Find a value.
Set & operator=(std::initializer_list< K > values)
Replace the contents with an initializer list.
const_iterator upper_bound(const K &value) const
Return the first value greater than value.
size_type erase(const K &value) noexcept
Erase a value.
Set(std::initializer_list< K > values, const Compare &compare)
Construct from an initializer list and a comparator.
bool operator==(const Set &other) const
Compare lexicographically.
bool operator<=(const Set &other) const
Compare lexicographically.
Set()
Construct an empty set.
bool empty() const noexcept
Test whether the set has no values.
bool contains(const K &value) const
Test whether a value is present.
iterator erase(const_iterator first, const_iterator last) noexcept
Erase [first, last).
value_compare value_comp() const
Return the ordering.
Pair< const_iterator, const_iterator > equal_range(const K &value) const
Return the range of values equal to value.
STORMBYTE_FORCE_INLINE void insert_range(R &&range)
Insert a copy of range.
Definition set.hxx:569
reverse_iterator rend() noexcept
Return the past-the-start reverse iterator.
key_compare key_comp() const
Return the ordering.
bool operator!=(const Set &other) const
Compare lexicographically.
Pair< iterator, iterator > equal_range(const K &value)
Return the range of values equal to value.
Set & operator=(Set &&other) noexcept
Move-assign the values.
size_type max_size() const noexcept
Return the maximum number of values.
bool operator>=(const Set &other) const
Compare lexicographically.
iterator end() noexcept
Return the past-the-end iterator.
~Set()
Destroy the values.
iterator erase(const_iterator position) noexcept
Erase the value at a read-only iterator.
iterator begin() noexcept
Return an iterator to the first value.
void clear() noexcept
Destroy every value.
Pair< iterator, bool > insert_result
Iterator to the value and whether it was inserted.
Definition set.hxx:232
const_reverse_iterator crend() const noexcept
Return the past-the-start reverse iterator.
Size size_type
Element count. Size, not std::size_t.
Definition set.hxx:83
std::reverse_iterator< iterator > reverse_iterator
Mutable reverse iterator.
Definition set.hxx:230
std::ptrdiff_t difference_type
Iterator distance type.
Definition set.hxx:84
Compare value_compare
Ordering of values. Same as the key ordering.
Definition set.hxx:82
Set(Set &&other)
Take the values.
iterator lower_bound(const K &value)
Return the first value not less than value.
size_type size() const noexcept
Return the number of values.
void swap(Set &other) noexcept
Exchange values and comparators.
Set(const Set &other)
Copy the values.
Compare key_compare
Ordering.
Definition set.hxx:81
Set(const Compare &compare)
Construct an empty set with a comparator.
const_iterator lower_bound(const K &value) const
Return the first value not less than value.
bool operator>(const Set &other) const
Compare lexicographically.
insert_result emplace(Args &&... args)
Construct a value in a new node if it is absent.
const_iterator find(const K &value) const
Find a value.
void merge(Set< K, OtherCompare > &source)
Take unique values from source.
insert_return_type insert(node_type &&handle)
Insert an extracted node if its value is absent.
Set(InputIt first, InputIt last)
Construct from an iterator range.
const_iterator cend() const noexcept
Return the past-the-end iterator.
Set(InputIt first, InputIt last, const Compare &compare)
Construct from an iterator range and a comparator.
iterator erase(iterator position) noexcept
Erase the value at an iterator.
node_type extract(const_iterator position)
Unlink the value at position and return that node.
const_reverse_iterator crbegin() const noexcept
Return a reverse iterator to the last value.
const_iterator cbegin() const noexcept
Return an iterator to the first value.
std::reverse_iterator< const_iterator > const_reverse_iterator
Read-only reverse iterator.
Definition set.hxx:231
const K & reference
Read-only value reference.
Definition set.hxx:85
iterator emplace_hint(const_iterator hint, Args &&... args)
Construct a value, using hint when the neighbours confirm it.
Set(std::initializer_list< K > values)
Construct from an initializer list.
K value_type
Stored value.
Definition set.hxx:80
insert_result insert(const K &value)
Insert a value if it is absent.
const K & const_reference
Read-only value reference.
Definition set.hxx:86
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.
Result of inserting an extracted node.
Definition set.hxx:309
node_type node
Returned node when the value was already present.
Definition set.hxx:312
bool inserted
Whether the node was linked.
Definition set.hxx:311
iterator position
Value, or end when the node was not inserted and is empty.
Definition set.hxx:310
#define STORMBYTE_PUBLIC_TYPE
Definition visibility.h:57
#define STORMBYTE_PUBLIC
Definition visibility.h:52