|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Set-like container backed by a dynamic array. More...
#include <tpl_dynarray_set.H>
Public Types | |
| using | Item_Type = T |
| using | Key_Type = T |
Public Types inherited from Aleph::DynArray< T > | |
| using | Item_Type = T |
| using | Key_Type = T |
| The type of element stored in the array. | |
| using | Const_Iterator = Aleph::Const_Iterator< Iterator > |
| Read-only iterator: the iterator of a constant array; it never allocates. | |
Public Types inherited from StlAlephIterator< DynArray< T > > | |
| using | iterator = StlIterator< DynArray< T > > |
| using | const_iterator = StlConstIterator< DynArray< T > > |
Public Member Functions | |
| DynArray_Set (Equal __eq) | |
| Construct an empty set using a custom equality predicate. | |
| DynArray_Set (Equal __eq, const size_t dim) | |
| Construct a set with a given initial dimension using a custom equality predicate. | |
| 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. | |
| const Equal & | get_equal () const noexcept |
| Return the equality predicate used by this container. | |
| void | set_equal (Equal __eq) |
| Replace the equality predicate used by this container. | |
| T * | insert (const T &item) |
Insert item (duplicates are allowed). | |
| T * | insert (T &&item) |
See insert(const T &). | |
| T * | search (const T &key) noexcept |
Search for the first element equal to key. | |
| const T * | search (const T &key) const noexcept |
See search(const T &). | |
| bool | contains (const T &key) const noexcept |
Check whether key is present. | |
| T & | find (const T &key) |
| Find and return a reference to the first matching element. | |
| const T & | find (const T &key) const |
See find(const T &). | |
| size_t | count (const T &key) const noexcept |
Count how many occurrences of key exist. | |
| bool | remove_one (const T &key) |
Remove a single occurrence of key. | |
| size_t | remove_all (const T &key) |
Remove all occurrences of key. | |
Public Member Functions inherited from Aleph::DynArray< T > | |
| size_t | get_dir_size () const noexcept |
| Return the directory size. | |
| size_t | get_seg_size () const noexcept |
| Return the segment size. | |
| size_t | get_block_size () const noexcept |
| Return the block size. | |
| size_t | size () const noexcept |
| Return the current dimension of array. | |
| size_t | max_size () const noexcept |
| Return the maximum allowed dimension (or the maximum number of elements that could have the array treated as a container). | |
| size_t | get_num_blocks () const noexcept |
| Return the number of blocks consumed by the array. | |
| void | set_default_initial_value (const T &value) noexcept(std::is_nothrow_copy_assignable_v< T >) |
| Set the default value. | |
| void | set_default_initial_value (T &&value=T()) noexcept(std::is_nothrow_swappable_v< T >) |
See set_default_initial_value(const T & value). | |
| DynArray (const size_t _pow_dir, const size_t _pow_seg, const size_t _pow_block) | |
| Construct a dynamic array given directory, segment and block sizes. | |
| DynArray () | |
| Construct an empty array with the default geometry. | |
| DynArray (const size_t dim) | |
| Construct an array of logical size dim without allocating entries. | |
| DynArray (const size_t n, const T &value) | |
| Construct an array of n copies of value; every entry is allocated. | |
| template<template< typename > class List> | |
| DynArray (const List< T > &l) | |
| template<class It > requires (not std::is_arithmetic_v<It> and requires (It it) { *it; ++it; it != it; }) | |
| DynArray (It b, It e) | |
| DynArray (std::initializer_list< T > l) | |
| ~DynArray () | |
| void | copy_array (const DynArray< T > &src_array) |
Copy the items of src_array to this | |
| DynArray (const DynArray< T > &array) | |
| Copy constructor: build an exact copy of array. | |
| DynArray< T > & | operator= (const DynArray< T > &array) |
Copy assignment: *this becomes an exact copy of array. | |
| void | swap (DynArray< T > &array) noexcept(std::is_nothrow_swappable_v< T >) |
Swap in constant time array with this | |
| DynArray (DynArray &&other) noexcept(std::is_nothrow_default_constructible_v< T > and std::is_nothrow_swappable_v< T >) | |
| Move constructor; allocates nothing. | |
| DynArray & | operator= (DynArray &&other) noexcept(std::is_nothrow_swappable_v< T >) |
Move assignment: swap the contents with other. | |
| T & | access (const size_t i) noexcept |
| Fast access without checking allocation and bound_min_clock checking. | |
| const T & | access (const size_t i) const noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const. | |
| T & | operator() (const size_t i) noexcept |
See access(const size_t i). | |
| const T & | operator() (const size_t i) const noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const. | |
| bool | exist (const size_t i) const |
Return true if the i-th entry is accessible. | |
| T * | test (const size_t i) const noexcept |
| Test if the i-th entry es writable,. | |
| T & | touch (const size_t i) |
| Touch the entry i. | |
| void | reserve (const size_t l, const size_t r) |
| Allocate a range of entries. | |
| void | reserve (const size_t dim) |
| Allocate the first dim entries and make size() at least dim. | |
| void | cut_ne (const size_t new_dim=0) |
| void | cut (const size_t new_dim=0) |
| Cut the array to a new dimension; that is, it reduces the dimension of array and frees the remaining memory. | |
| void | adjust (const size_t dim) |
| Set a new dimension. | |
| void | empty () noexcept |
| Empty the array. | |
| void | clear () noexcept |
| Empties the container. | |
| const T & | read (const size_t i) const |
| Read entry i without allocating memory. | |
| const T & | operator[] (const size_t i) const |
| Read entry i of a constant array; equivalent to read(i). | |
| Proxy | operator[] (const size_t i) |
| Access entry i of a modifiable array through a proxy. | |
| T & | nth (const size_t n) |
| Return a modifiable reference to entry n. | |
| const T & | nth (const size_t n) const |
| Return entry n of a constant array; equivalent to read(n). | |
| T & | nth_ne (const size_t n) |
| Return a modifiable reference to entry n without checking n. | |
| const T & | nth_ne (const size_t n) const noexcept |
| Return entry n of a constant array without checking n. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, T &> | |
| T * | find_ptr (Operation &operation) |
| Return a pointer to the first entry satisfying a criterion. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| const T * | find_ptr (Operation &operation) const |
| Constant overload of find_ptr(); it never allocates memory. | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, T &> | |
| T * | find_ptr (Operation &&operation) |
See find_ptr(Operation & operation). | |
| template<class Operation > requires Aleph::InvocablePredicateWith<Operation &, const T &> | |
| const T * | find_ptr (Operation &&operation) const |
See find_ptr(Operation & operation) const. | |
| T & | append () |
| Allocate a new entry to the end of array. | |
| T & | append (const T &data) |
Copy data to the end of array, increase the dimension and return a modifiable reference to the copied data. | |
| T & | append (T &&data) |
Move data to the end of array, increase the dimension and return a modifiable reference to the copied data. | |
| T & | insert (const T &item) |
Insert a copy of item at the beginning of the array. | |
| T & | insert (T &&item) |
Move item to the beginning of the array. | |
| void | push (const T &data) |
See append(const T & data). | |
| T & | push (T &&data) |
See append(T && data). | |
| void | put (const T &data) |
See append(const T & data). | |
| T & | put (T &&data) |
See append(T && data). | |
| void | remove (T &item) |
| Given a valid reference to an item in the array, it removes it and decrease the dimension. | |
| void | erase (T &item) |
See remove(T & item). | |
| bool | is_empty () const noexcept |
Return true if the array is empty. | |
| Array< T > | to_array () const |
| Copy contents into Aleph::Array (requires copyable elements). | |
| DynArray & | reverse () |
| Reverse the order of items in an array. | |
| T | pop () |
| Remove the last item of array (as if this was a stack) | |
| T & | top () |
| Return a modifiable reference to the last item of stack. | |
| const T & | top () const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const, it never allocates. | |
| T & | get_first () |
| Return a modifiable reference to the first item of array (as if this was a queue) | |
| const T & | get_first () const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const, it never allocates. | |
| T & | get_last () |
| Return a modifiable reference to the last item of array (as if this was a queue) | |
| const T & | get_last () const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. A reference to const, it never allocates. | |
| Iterator | get_it () |
| Iterator on the modifiable array, positioned on entry 0. | |
| Const_Iterator | get_it () const |
| Iterator on the constant array, positioned on entry 0. | |
| Iterator | get_it (const size_t pos) |
| Iterator on the modifiable array, positioned on entry pos. | |
| Const_Iterator | get_it (const size_t pos) const |
| Iterator on the constant array, positioned on entry pos. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const T &> | |
| bool | traverse (Operation &operation) const noexcept(Aleph::NothrowPredicateWith< Operation &, const T & >) |
| Traverse a constant array and execute a conditioned operation, which must have the signature: | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, T &> | |
| bool | traverse (Operation &operation) |
Traverse a modifiable array; operation receives modifiable references, with the signature bool operation(T & item). | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, const T &> | |
| bool | traverse (Operation &&operation) const noexcept(Aleph::NothrowPredicateWith< Operation &, const T & >) |
See traverse(Operation & operation) const. | |
| template<class Operation > requires Aleph::PredicateWith<Operation &, T &> | |
| bool | traverse (Operation &&operation) |
See traverse(Operation & operation). | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (Operation &operation) const |
| Alias of for_each(); see FunctionalMethods::for_each(). | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (Operation &&operation) const |
See each(Operation & operation) const. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (const size_t pos, const size_t slice, Operation &operation) const |
| Visit the entries at positions pos, pos + slice, ... of a constant array; see FunctionalMethods::each(). | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, const T &> | |
| void | each (const size_t pos, const size_t slice, Operation &&operation) const |
See each(size_t pos, size_t slice, Operation & operation) const. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| void | each (const size_t pos, const size_t slice, Operation &operation) |
| Visit, and possibly modify, the entries at positions pos, pos + slice, pos + 2 slice, ... of a modifiable array. | |
| template<class Operation > requires Aleph::InvocableWith<Operation &, T &> | |
| void | each (const size_t pos, const size_t slice, Operation &&operation) |
See each(size_t pos, size_t slice, Operation & operation). | |
Public Member Functions inherited from LocateFunctions< DynArray< T >, T > | |
| auto | get_it () |
| Return a properly initialized iterator positioned at the first item on the container. | |
| auto | get_it () const |
| Read-only iterator positioned at the first item. | |
| auto | get_it (const size_t pos) |
Return a properly initialized iterator positioned at the pos item on the container. | |
| auto | get_it (const size_t pos) const |
Read-only iterator positioned at the pos item. | |
| auto | get_itor () |
Alias of get_it(). | |
| auto | get_itor () const |
See get_itor(). | |
| T & | nth_ne (const size_t n) noexcept(Aleph::dry_detail::mutable_traversal_is_noexcept< C, T >) |
| Return the n‑th element without bounds checking. | |
| const T & | nth_ne (const size_t n) const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< DynArray< T >, T >) |
Constant overload of nth_ne(size_t). | |
| T & | nth (const size_t n) |
| Return the n-th item of the container. | |
| const T & | nth (const size_t n) const |
Const overload of nth(size_t). | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > T * | find_ptr (Operation &operation) noexcept(mutable_search_is_noexcept< Operation >()) |
| Find a pointer to an item in the container according to a searching criterion. | |
| const T * | find_ptr (Operation &operation) const noexcept(const_search_is_noexcept< Operation >()) |
Const overload of find_ptr(Operation&). | |
| const T * | find_ptr (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Overload of find_ptr() const that accepts rvalues. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > T * | find_ptr (Operation &&operation) noexcept(mutable_search_is_noexcept< Operation >()) |
| Overload of find_ptr() that accepts rvalues. | |
| size_t | find_index (Operation &operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Find the position of an item in the container according to a searching criterion. | |
| size_t | find_index (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Overload of find_index() that accepts rvalues. | |
| and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, T > | find_item (Operation &operation) const noexcept(find_item_is_noexcept< Operation >()) |
| Safe sequential searching of an item matching a criterion. | |
| and std::default_initializable< T > and std::copy_constructible< T > std::tuple< bool, T > | find_item (Operation &&operation) const noexcept(find_item_is_noexcept< Operation >()) |
| Overload of find_item() that accepts rvalues. | |
| and std::copy_constructible< T > std::optional< T > | find_opt (Operation &operation) const |
| Copy of the first item satisfying a criterion, if any. | |
| and std::copy_constructible< T > std::optional< T > | find_opt (Operation &&operation) const |
| Overload of find_opt() that accepts rvalues. | |
| bool | contains_if (Operation &&operation) const noexcept(const_search_is_noexcept< Operation >()) |
| Test if an item satisfying a criterion is present in the container. | |
| bool | contains (const T &item) const |
| Test if an item is present in the container using equality. | |
Public Member Functions inherited from FunctionalMethods< DynArray< T >, T > | |
| void | emplace (Args &&... args) |
| Appends a new element into the container by constructing it from the given args. | |
| void | emplace_end (Args &&... args) |
See emplace(Args && ... args). | |
| void | emplace_ins (Args &&... args) |
| size_t | ninsert (Args &&... args) |
| Insert n variadic items. | |
| size_t | nappend (Args &&... args) |
| Append n variadic items. | |
| void | for_each (Operation &operation) const |
| Traverse all the container and performs an operation on each element. | |
| void | for_each (Operation &&operation) const |
| Overload of for_each() that accepts rvalues. | |
| void | each (Operation &operation) const |
| Alias of for_each(). | |
| void | each (Operation &&operation) const |
| Alias of for_each() that accepts rvalues. | |
| void | each (const size_t pos, const size_t slice, Operation &operation) const |
Traverse the container starting at pos taking one item every slice, performing an operation on each visited element. | |
| void | each (const size_t pos, const size_t slice, Operation &&operation) const |
See each(size_t pos, size_t slice, Operation & operation) const. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > void | each (const size_t pos, const size_t slice, Operation &operation) |
Traverse the container starting at pos taking one item every slice, performing an operation that may modify each visited item. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > void | each (const size_t pos, const size_t slice, Operation &&operation) |
See each(size_t pos, size_t slice, Operation & operation). | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > void | mutable_for_each (Operation &operation) |
| Apply a mutable operation to each element of the container. | |
| and Aleph::dry_detail::MutablyTraversable< typename Aleph::concepts_detail::defer< DynArray< T >, Operation >::type, T > void | mutable_for_each (Operation &&operation) |
See mutable_for_each(Operation & operation). | |
| bool | all (Operation &operation) const |
| Check if all the elements of the container satisfy a condition. | |
| bool | all (Operation &&operation) const |
| Overload of all() that accepts rvalues. | |
| bool | exists (Operation &op) const |
| Test for existence in the container of an element satisfying a criterion. | |
| bool | exists (Operation &&op) const |
| Overload of exists() that accepts rvalues. | |
| bool | none (Operation &op) const |
| Test that no element satisfies a criterion. | |
| bool | none (Operation &&op) const |
| Overload of none() that accepts rvalues. | |
| size_t | count_if (Operation &op) const |
| Count the elements that satisfy a criterion. | |
| size_t | count_if (Operation &&op) const |
| Overload of count_if() that accepts rvalues. | |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps (Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps (Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps_if (Prop prop, Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | maps_if (Prop prop, Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map (Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map (Operation &&op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map_if (Prop prop, Operation &op) const |
| Aleph::DynList< Aleph::dry_detail::map_result_t< R, Operation &, T > > | map_if (Prop prop, Operation &&op) const |
| auto | flat_map (Operation &op) const |
| Map each element to a container and concatenate the results. | |
| auto | flat_map (Operation &&op) const |
| Overload of flat_map() that accepts rvalues. | |
| Aleph::DynList< T > | to_dynlist () const |
| Convert container to DynList. | |
| std::vector< T > | to_vector () const |
| Convert container to std::vector. | |
| Acc | foldl (const Acc &init, Op &op) const |
| Fold the elements of the container to a specific result. | |
| Acc | foldl (const Acc &init, Op &&op) const |
| Overload of foldl() that accepts rvalues. | |
| Acc | fold_left (const Acc &init, Op &op) const |
| Alias for foldl(). | |
| Acc | fold_left (const Acc &init, Op &&op) const |
| Overload of fold_left() that accepts rvalues. | |
| T | fold (const T &init, Operation &operation) const |
| Simplified version of foldl() where the folded type is the same type of elements stored in the container. | |
| T | fold (const T &init, Operation &&operation) const |
| Overload of fold() that accepts rvalues. | |
| Acc | foldr (const Acc &init, Op &op) const |
| Fold the elements from the last to the first. | |
| Acc | foldr (const Acc &init, Op &&op) const |
| Overload of foldr() that accepts rvalues. | |
| and std::copy_constructible< U > std::optional< T > | reduce (Op &op) const |
| Fold the elements with no initial value. | |
| and std::copy_constructible< U > std::optional< T > | reduce (Op &&op) const |
| Overload of reduce() that accepts rvalues. | |
| Aleph::DynList< T > | filter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion. | |
| Aleph::DynList< T > | filter (Operation &&operation) const |
| Overload of filter() that accepts rvalues. | |
| Aleph::DynList< const T * > | ptr_filter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion and return a pointer to the matched items in the container. | |
| Aleph::DynList< const T * > | ptr_filter (Operation &&operation) const |
| Overload of ptr_filter() that accepts rvalues. | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &operation) const |
| Filter the elements of a container according to a matching criterion and determine its positions respect to the traversal of container. | |
| Aleph::DynList< std::tuple< T, size_t > > | pfilter (Operation &&operation) const |
| Overload of pfilter() that accepts rvalues. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &op) const |
| Exclusive partition of container according to a filter criterion. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (Operation &&op) const |
| Overload of partition() that accepts rvalues. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | partition (size_t n) const |
| Exclusive partition of container in the nth item. | |
| std::pair< Aleph::DynList< T >, Aleph::DynList< T > > | split_half () const |
| Split the container into two halves by alternating elements. | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &op) const |
| Exclusive partition of container according to a filter criterion. | |
| std::tuple< Aleph::DynList< T >, Aleph::DynList< T > > | tpartition (Operation &&op) const |
| Overload of tpartition() that accepts rvalues. | |
| size_t | length () const noexcept(Aleph::dry_detail::const_traversal_is_noexcept< DynArray< T >, T >) |
| Count the number of elements of a container. | |
| Aleph::DynList< T > | rev () const |
| Return a list with the elements of container in reverse order respect to its traversal order. | |
| Aleph::DynList< T > | take (const size_t n) const |
| Return a list with the first n elements seen in the container during its traversal. | |
| Aleph::DynList< T > | take (size_t i, const size_t j, const size_t step=1) const |
Return a list with the elements at positions i, i + step, i + 2 step, ... that are not greater than j, respect to the traversal order. | |
| Aleph::DynList< T > | drop (const size_t n) const |
| Drop the first n elements seen in the container during its traversal. | |
| Aleph::DynList< T > | take_while (Operation &op) const |
| The longest prefix of elements that satisfy a criterion. | |
| Aleph::DynList< T > | take_while (Operation &&op) const |
| Overload of take_while() that accepts rvalues. | |
| Aleph::DynList< T > | drop_while (Operation &op) const |
| The elements after the longest prefix that satisfies a criterion. | |
| Aleph::DynList< T > | drop_while (Operation &&op) const |
| Overload of drop_while() that accepts rvalues. | |
| void | mutable_drop (const size_t n) |
| Drop the first n elements seen from container. | |
Public Member Functions inherited from GenericItems< Container, T > | |
| Aleph::DynList< T > | items () const |
| Return a list of all the elements of a container sorted by traversal order. | |
| Aleph::DynList< T > | keys () const |
See items(). | |
Public Member Functions inherited from EqualSequenceMethod< DynArray< T > > | |
| bool | equal_to (const DynArray< T > &r) const |
Equality test between this and r. | |
Public Member Functions inherited from StlAlephIterator< DynArray< T > > | |
| iterator | begin () noexcept |
| Return an STL-compatible iterator to the first element. | |
| const_iterator | begin () const noexcept |
| Return a const iterator to the first element. | |
| iterator | end () noexcept |
| Return an STL-compatible end iterator. | |
| const_iterator | end () const noexcept |
| Return a const end iterator. | |
| const_iterator | cbegin () const noexcept |
| Return a const iterator to the first element. | |
| const_iterator | cend () const noexcept |
| Return a const end iterator. | |
Static Public Member Functions | |
| template<typename... Items> requires requires (Items &&... items) { DynArray_Set ::template build_as< DynArray_Set >(std::forward<Items>(items)...); } | |
| static DynArray_Set | build (Items &&... items) |
Static Public Member Functions inherited from Aleph::DynArray< T > | |
| static void | compute_sizes (const size_t n, size_t &d, size_t &s, size_t &b) |
Given a dimension n, it proposes values for the directory, segment and block sizes. | |
| static std::tuple< size_t, size_t, size_t > | compute_sizes (const size_t n) |
Given a dimension n, it proposes values for the directory, segment and block sizes. | |
Static Public Member Functions inherited from FunctionalMethods< DynArray< T >, T > | |
| static DynArray< T > | build (Items &&... items) |
| Build a container that holds the given items. | |
| static D | build_as (Items &&... items) |
Build a D, a class derived from the container, holding the given items. | |
Private Types | |
| using | Base = DynArray< T > |
Private Attributes | |
| Equal | eq |
Additional Inherited Members | |
Public Attributes inherited from FunctionalMethods< DynArray< T >, T > | |
| and | |
| Insert a new element into the container by constructing it from the given args. | |
| and Aleph::InvocableWith< Operation &, const T & > | and |
| Conditional mapping of the elements of the container. | |
Static Public Attributes inherited from Aleph::DynArray< T > | |
| static const size_t | Default_Pow_Dir = 6 |
| The type of element stored in the array. | |
| static const size_t | Default_Pow_Seg = 8 |
| Default two power for directory size. | |
| static const size_t | Default_Pow_Block = 12 |
| Default two power for segment size. | |
| static const unsigned long long | Max_Dim_Allowed = 256 * 1024 * 1024 * 1024ull |
| Maximum dimension allowed. | |
Set-like container backed by a dynamic array.
DynArray_Set<T, Equal> is a lightweight set-like container that stores its elements in a DynArray<T>.
This container allows duplicates for performance reasons.
| T | Element type. |
| Equal | Equality predicate used for linear search. It must model a boolean binary predicate. |
Definition at line 75 of file tpl_dynarray_set.H.
|
private |
Definition at line 77 of file tpl_dynarray_set.H.
| using Aleph::DynArray_Set< T, Equal >::Item_Type = T |
Definition at line 82 of file tpl_dynarray_set.H.
| using Aleph::DynArray_Set< T, Equal >::Key_Type = T |
Definition at line 83 of file tpl_dynarray_set.H.
|
inlineexplicit |
Construct an empty set using a custom equality predicate.
| __eq | Equality predicate used by linear search methods. |
Definition at line 92 of file tpl_dynarray_set.H.
|
inline |
Construct a set with a given initial dimension using a custom equality predicate.
| __eq | Equality predicate used by linear search methods. |
| dim | Initial dimension. |
Definition at line 103 of file tpl_dynarray_set.H.
|
inline |
Construct a set using custom DynArray layout parameters and a custom equality predicate.
| __eq | Equality predicate used by linear search methods. |
| _pow_dir | Directory power-of-two. |
| _pow_seg | Segment power-of-two. |
| _pow_block | Block power-of-two. |
Definition at line 116 of file tpl_dynarray_set.H.
|
inlinestatic |
Definition at line 86 of file tpl_dynarray_set.H.
Referenced by TEST().
|
inlinenoexcept |
Check whether key is present.
Definition at line 170 of file tpl_dynarray_set.H.
References Aleph::DynArray_Set< T, Equal >::search().
|
inlinenoexcept |
Count how many occurrences of key exist.
Definition at line 196 of file tpl_dynarray_set.H.
References Aleph::DynArray< T >::access(), Aleph::DynArray_Set< T, Equal >::eq, and Aleph::DynArray< T >::size().
|
inline |
Find and return a reference to the first matching element.
| std::domain_error | if key is not found. |
Definition at line 179 of file tpl_dynarray_set.H.
References ah_domain_error_if, and Aleph::DynArray_Set< T, Equal >::search().
Referenced by Aleph::DynArray_Set< T, Equal >::find(), and TEST().
|
inline |
See find(const T &).
Definition at line 187 of file tpl_dynarray_set.H.
References Aleph::DynArray_Set< T, Equal >::find().
|
inlinenoexcept |
Return the equality predicate used by this container.
Definition at line 123 of file tpl_dynarray_set.H.
References Aleph::DynArray_Set< T, Equal >::eq.
|
inline |
Insert item (duplicates are allowed).
| std::bad_alloc | if memory allocation fails. |
Definition at line 137 of file tpl_dynarray_set.H.
References Aleph::DynArray< T >::append().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
See insert(const T &).
Definition at line 143 of file tpl_dynarray_set.H.
References Aleph::DynArray< T >::append().
|
inline |
Remove all occurrences of key.
Definition at line 224 of file tpl_dynarray_set.H.
References Aleph::DynArray< T >::access(), Aleph::DynArray_Set< T, Equal >::eq, Aleph::DynArray< T >::remove(), and Aleph::DynArray< T >::size().
Referenced by TEST().
|
inline |
Remove a single occurrence of key.
If there are multiple occurrences, only one is removed.
Definition at line 211 of file tpl_dynarray_set.H.
References Aleph::DynArray< T >::remove(), and Aleph::DynArray_Set< T, Equal >::search().
Referenced by TEST().
|
inlinenoexcept |
See search(const T &).
Definition at line 161 of file tpl_dynarray_set.H.
References Aleph::DynArray_Set< T, Equal >::search().
|
inlinenoexcept |
Search for the first element equal to key.
Definition at line 152 of file tpl_dynarray_set.H.
References Aleph::DynArray< T >::access(), Aleph::DynArray_Set< T, Equal >::eq, and Aleph::DynArray< T >::size().
Referenced by Aleph::DynArray_Set< T, Equal >::contains(), Aleph::DynArray_Set< T, Equal >::find(), Aleph::DynArray_Set< T, Equal >::remove_one(), Aleph::DynArray_Set< T, Equal >::search(), TEST(), TEST(), and TEST().
|
inline |
Replace the equality predicate used by this container.
search() / contains() operations. Definition at line 130 of file tpl_dynarray_set.H.
References Aleph::DynArray_Set< T, Equal >::eq.
|
private |