12#if HX_USE_MACROS_WITH_MODULE
13#error Header does not provide macros alone.
47template<
typename key_t_,
87 template<hx
size_t capacity_x_>
101 const key_t_*
begin(
void)
const {
return this->
data(); }
110 const key_t_*
cend(
void)
const {
return m_end_; }
126 const key_t_*
end(
void)
const {
return m_end_; }
131 template<hx
size_t capacity_x_>
142 const key_t_*
erase(
const key_t_* pos_)
noexcept;
157 const key_t_*
insert(
const key_t_& key_)
noexcept;
161 const key_t_*
insert(key_t_&& key_)
noexcept;
166 template<hx
size_t capacity_x_>
200 template<
typename,
typename,
bool, hx
size_t>
friend class hxflat_set;
202 template<
typename key_u_>
203 const key_t_* insert_at_(key_t_* pos_, key_u_&& key_)
noexcept;
210#if HX_CPLUSPLUS >= 202002L
213template<
typename key_t_,
typename compare_t_,
bool multi_t_,
224template<
typename key_t_,
typename compare_t_,
bool multi_t_,
235template<
typename key_t_,
typename compare_t_,
bool multi_t_>
243#include "detail/hxflat_set.inl"
hxallocator(void)
Definition hxallocator.hpp:35
const key_t_ * data(void) const
Definition hxallocator.hpp:45
hxflat_set - A sorted associative container that stores keys in a single array.
Definition hxflat_set.hpp:51
~hxflat_set(void) noexcept
Destructs the set and destroys all keys.
hxflat_set(void)
Constructs an empty set.
const key_t_ * insert(key_t_ &&key_) noexcept
Move overload of insert.
hxsize_t size(void) const
Returns the number of elements in the set.
Definition hxflat_set.hpp:187
hxsize_t capacity(void) const
Returns the capacity of the set or 0 if unallocated.
void swap(hxflat_set &x_) noexcept
Swaps the contents with x.
const key_t_ * erase(const key_t_ *pos_) noexcept
Removes the element at the pointer position and destroys the key.
const key_t_ * upper_bound(const key_t_ &key_) const
Returns a const pointer to the first element whose key is ordered after key.
void operator=(hxflat_set &&x_) noexcept
Move assigns from a temporary set using swap.
const key_t_ * lower_bound(const key_t_ &key_) const
Returns a const pointer to the first element whose key is not ordered before key.
const key_t_ * const_iterator
const_iterator - Const random access iterator over keys.
Definition hxflat_set.hpp:60
hxflat_set(const hxflat_set &x_) noexcept
Copy constructs from another hxflat_set.
compare_t_ compare_t
Definition hxflat_set.hpp:54
const key_t_ * iterator
iterator - Random access iterator over keys.
Definition hxflat_set.hpp:57
const key_t_ * insert(const key_t_ &key_) noexcept
Inserts a key.
bool equal(const hxflat_set< key_t_, compare_t_, multi_t_, capacity_x_ > &x_) const
Returns true if this set and x contain the same keys in the same order using hxkey_equal.
bool full(void) const
Returns true if the set has reached its capacity.
Definition hxflat_set.hpp:150
const key_t_ * operator[](hxsize_t index_) const
Returns a const pointer to the element at index.
hxflat_set(hxflat_set &&x_) noexcept
Move constructs from a temporary hxflat_set.
hxsize_t max_size(void) const
Returns the capacity of the set.
Definition hxflat_set.hpp:175
bool empty(void) const
Checks if the set contains no elements.
Definition hxflat_set.hpp:123
const key_t_ * end(void) const
Returns a const pointer past the last element.
Definition hxflat_set.hpp:126
const key_t_ * find(const key_t_ &key_) const
Returns a const pointer to the key if found, or hxnull if not present.
bool less(const hxflat_set< key_t_, compare_t_, multi_t_, capacity_x_ > &x_) const
Returns true if this set compares less than x lexicographically, using hxkey_equal and hxkey_less on ...
void clear(void) noexcept
Removes all elements and destroys their keys.
const key_t_ * begin(void) const
Returns a const pointer to the first element.
Definition hxflat_set.hpp:101
void operator=(const hxflat_set< key_t_, compare_t_, multi_t_, capacity_x_ > &x_) noexcept
Cross-capacity copy assignment.
key_t_ key_t
Definition hxflat_set.hpp:53
void reserve(hxsize_t cap_, hxsystem_allocator_t allocator_=hxsystem_allocator_current, hxalignment_t alignment_=hxalignment)
Allocates storage for cap keys.
void operator=(const hxflat_set &x_) noexcept
Assigns the contents of x to this set.
hxsize_t count(const key_t_ &key_) const
Returns the number of elements with the given key.
hxsize_t erase(const key_t_ &key_) noexcept
Removes all elements with the given key and destroys their keys.
const key_t_ * cend(void) const
Returns a const pointer past the last element.
Definition hxflat_set.hpp:110
const key_t_ * cbegin(void) const
Returns a const pointer to the first element (alias for begin).
Definition hxflat_set.hpp:107
hxkey_less_t<T> - A constexpr callable that invokes hxkey_less.
Definition hxkey.hpp:131
Similar to std::allocator.
HX_NS_BEGIN_ constexpr hxsize_t hxallocator_dynamic_capacity
hxallocator_dynamic_capacity - A capacity value that allows for dynamic allocation.
Definition hxallocator.hpp:20
bool hxkey_equal(const hxflat_set< key_t_, compare_t_, multi_t_, capacity_x_ > &x_, const hxflat_set< key_t_, compare_t_, multi_t_, capacity_y_ > &y_)
bool hxkey_equal(hxflat_set<K>& x, hxflat_set<K>& y) - Compares the contents of x and y for equivalen...
Definition hxflat_set.hpp:215
void hxswap(hxflat_set< key_t_, compare_t_, multi_t_, hxallocator_dynamic_capacity > &x_, hxflat_set< key_t_, compare_t_, multi_t_, hxallocator_dynamic_capacity > &y_) noexcept
void hxswap(hxflat_set<K>& x, hxflat_set<K>& y) - Exchanges the contents of x and y.
Definition hxflat_set.hpp:236
bool hxkey_less(const hxflat_set< key_t_, compare_t_, multi_t_, capacity_x_ > &x_, const hxflat_set< key_t_, compare_t_, multi_t_, capacity_y_ > &y_)
bool hxkey_less(hxflat_set<K>& x, hxflat_set<K>& y) - Compares the contents of x and y lexicographica...
Definition hxflat_set.hpp:226
User-overloadable key-equal, key-less, and key-hash functions.
@ hxsystem_allocator_current
hxsystem_allocator_current - Use current allocation scope.
Definition hxmemory_manager.h:82
int hxsystem_allocator_t
hxsystem_allocator_t - This is extendable by the application.
Definition hxmemory_manager.h:77
unsigned int hxalignment_t
hxalignment_t - A positive integer power of 2 for aligning allocations.
Definition hxmemory_manager.h:64
constexpr hxalignment_t hxalignment
hxalignment - The default alignment.
Definition hxmemory_manager.h:69
#define hxinline
hxinline - Force a function to be inlined into its callers.
Definition hxsettings.h:120
#define hxattr_nodiscard
hxattr_nodiscard - Indicates the caller should not discard the return value.
Definition hxsettings.h:89
#define hxattr_flatten
hxattr_flatten - Inline every call inside a function's body into it, recursively, regardless of the c...
Definition hxsettings.h:82
Standard sorting utilities.
void hxswap_memcpy(T &x_, T &y_)
hxswap_memcpy - Exchanges the contents of x and y using memcpy and a stack temporary.
Definition hxutility.h:354
Provides core macros, memory management and feature detection.
ptrdiff_t hxsize_t
hxsize_t - A signed size type, same as ssize_t or ptrdiff_t.
Definition libhatchet.h:209