39# ifndef TPL_DYNARRAY_SET_H
40# define TPL_DYNARRAY_SET_H
74 template <
typename T,
class Equal = Aleph::equal_to<T>>
116 DynArray_Set(Equal __eq,
size_t _pow_dir,
size_t _pow_seg,
size_t _pow_block)
117 :
Base(_pow_dir, _pow_seg, _pow_block),
eq(
std::move(__eq))
139 return &this->
append(item);
145 return &this->
append(std::forward<T>(item));
154 for (
size_t i = 0; i < this->
size(); ++i)
172 return search(key) !=
nullptr;
196 size_t count(
const T & key)
const noexcept
199 for (
size_t i = 0; i < this->
size(); ++i)
227 for (
size_t i = 0; i < this->
size();)
#define Derived_Build(Name)
Declare build() in a class derived from a container.
Exception handling system with formatted messages for Aleph-w.
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
Set-like container backed by a dynamic array.
T & find(const T &key)
Find and return a reference to the first matching element.
T * insert(T &&item)
See insert(const T &).
const T & find(const T &key) const
See find(const T &).
DynArray_Set(Equal __eq, size_t _pow_dir, size_t _pow_seg, size_t _pow_block)
Construct a set using custom DynArray layout parameters and a custom equality predicate.
T * search(const T &key) noexcept
Search for the first element equal to key.
size_t count(const T &key) const noexcept
Count how many occurrences of key exist.
DynArray_Set(Equal __eq, const size_t dim)
Construct a set with a given initial dimension using a custom equality predicate.
bool remove_one(const T &key)
Remove a single occurrence of key.
size_t remove_all(const T &key)
Remove all occurrences of key.
DynArray_Set(Equal __eq)
Construct an empty set using a custom equality predicate.
bool contains(const T &key) const noexcept
Check whether key is present.
const Equal & get_equal() const noexcept
Return the equality predicate used by this container.
const T * search(const T &key) const noexcept
See search(const T &).
void set_equal(Equal __eq)
Replace the equality predicate used by this container.
T * insert(const T &item)
Insert item (duplicates are allowed).
size_t size() const noexcept
Return the current dimension of array.
T & access(const size_t i) noexcept
Fast access without checking allocation and bound_min_clock checking.
T & append()
Allocate a new entry to the end of array.
void remove(T &item)
Given a valid reference to an item in the array, it removes it and decrease the dimension.
__gmp_expr< typename __gmp_resolve_expr< T, V >::value_type, __gmp_binary_expr< __gmp_expr< T, U >, __gmp_expr< V, W >, __gmp_dim_function > > dim(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
Main namespace for Aleph-w library functions.
std::decay_t< typename HeadC::Item_Type > T
Lazy and scalable dynamic array implementation.
Comprehensive sorting algorithms and search utilities for Aleph-w.