|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Simple test container using std::vector internally but with Aleph mixins. More...
Classes | |
| class | Iterator |
Public Types | |
| using | Item_Type = T |
Public Member Functions | |
| MixinVector ()=default | |
| MixinVector (std::initializer_list< T > init) | |
| void | append (const T &item) |
| void | insert (const T &item) |
| size_t | size () const noexcept |
| bool | is_empty () const noexcept |
| Iterator | get_it () const |
| bool | operator== (const MixinVector &other) const |
Public Member Functions inherited from Aleph::TraverseMixin< MixinVector< T >, T > | |
| bool | traverse (Operation &operation) const |
| Traverse all elements, applying an operation to each. | |
| bool | traverse (Operation &operation) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| bool | traverse (Operation and operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| bool | traverse (Operation and operation=Operation()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Public Member Functions inherited from Aleph::LocateMixin< MixinVector< T >, T > | |
| T & | nth (const size_t n) const |
| Access the n-th element (bounds-checked). | |
| T & | nth_ne (const size_t n) const noexcept |
| Access the n-th element (unchecked). | |
| T * | find_ptr (Operation &operation) |
| Find the first element satisfying a predicate. | |
| T * | find_ptr (Operation &operation) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| T * | find_ptr (Operation and operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| T * | find_ptr (Operation and operation=Operation()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| std::tuple< bool, T > | find_item (Operation &operation) |
| Find element with success flag. | |
| std::tuple< bool, T > | find_item (Operation &operation) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| std::tuple< bool, T > | find_item (Operation &&operation=Operation()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| std::tuple< bool, T > | find_item (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Public Member Functions inherited from Aleph::FunctionalMixin< MixinVector< T >, T > | |
| auto | for_each (Operation &operation) const -> decltype(self()) |
| Apply an operation to each element (read-only). | |
| auto | for_each (Operation &operation) -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| auto | for_each (Operation &&operation=Operation()) const -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| auto | for_each (Operation &&operation=Operation()) -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| auto | mutable_for_each (Operation &operation) -> decltype(self()) |
| Apply an operation to each element (mutable). | |
| auto | mutable_for_each (Operation &&operation=Operation()) -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| bool | all (Operation &operation) const |
| Test if all elements satisfy a predicate. | |
| bool | all (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| bool | forall (Operation &operation) const |
| Alias for all(). | |
| bool | forall (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| bool | exists (Operation &operation) const |
| Test if any element satisfies a predicate. | |
| bool | exists (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| Container< __Type > | maps (Operation &operation) const |
| Transform elements using a mapping function. | |
| Container< __Type > | maps (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| __Type | foldl (const __Type &init, std::function< __Type(const __Type &, const T &)> operation) const |
| Left fold (reduce) with initial value. | |
| __Type | fold_left (std::function< __Type(const __Type &, const T &)> operation, const __Type &init) const |
| Left fold with operation first (alternative signature). | |
| T | fold (const T &init, Operation &operation) const |
| Simple fold with same type for accumulator and elements. | |
| T | fold (const T &init, Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| DynList< T > | filter (Operation &operation) const |
| Filter elements by a predicate. | |
| DynList< T > | filter (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| DynList< std::tuple< T, size_t > > | pfilter (Operation &operation) const |
| Filter with position information. | |
| DynList< std::tuple< T, size_t > > | pfilter (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| std::pair< DynList< T >, DynList< T > > | partition (Operation &op) const |
| Partition elements by a predicate. | |
| std::pair< DynList< T >, DynList< T > > | partition (Operation &&op=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| std::tuple< DynList< T >, DynList< T > > | tpartition (Operation &op) const |
| Partition returning tuple instead of pair. | |
| std::tuple< DynList< T >, DynList< T > > | tpartition (Operation &&op=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| size_t | length () const noexcept |
| Count the number of elements. | |
| Container< T > | rev () const |
| Create a reversed copy. | |
| Container< T > | take (const size_t n) const |
| Take the first n elements. | |
| Container< T > | drop (const size_t n) const |
| Skip the first n elements. | |
| T | sum (const T &init=T {}) const |
| Compute the sum of all elements. | |
| T | product (const T &init) const |
| Compute the product of all elements. | |
| const T * | min () const |
| Find the minimum element. | |
| const T * | max () const |
| Find the maximum element. | |
| const T * | min_by (Compare cmp) const |
| Find the minimum element using a custom comparator. | |
| const T * | max_by (Compare cmp) const |
| Find the maximum element using a custom comparator. | |
| bool | has_value (const T &val) const |
| Check if container has a value. | |
| bool | none (Predicate &pred) const |
| Check if no element satisfies a predicate. | |
| bool | none (Predicate &&pred) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| size_t | count_if (Predicate pred) const |
| Count elements satisfying a predicate. | |
| const T * | first () const |
| Get the first element. | |
| T | first_or (const T &default_val) const |
| Get the first element or a default value. | |
| const T * | last () const |
| Get the last element. | |
| T | last_or (const T &default_val) const |
| Get the last element or a default value. | |
| Container< std::pair< size_t, T > > | enumerate () const |
| Enumerate elements with their indices. | |
| size_t | find_index (Predicate pred) const |
| Find the index of the first element satisfying a predicate. | |
| size_t | index_of (const T &val) const |
| Find the index of a specific value. | |
| Container< T > | unique () const |
| Remove consecutive duplicate elements. | |
| Container< T > | unique_by (EqPred eq) const |
| Remove consecutive duplicates using a custom equality predicate. | |
| Container< T > | intersperse (const T &sep) const |
| Intersperse a separator between elements. | |
| Container< Container< T > > | chunk (size_t n) const |
| Split into chunks of fixed size. | |
| Container< Container< T > > | sliding (size_t size, size_t step=1) const |
| Create sliding windows of fixed size. | |
| std::vector< T > | to_vector () const |
| Convert to std::vector. | |
| DynListType | to_dynlist () const |
| Convert container to DynList. | |
| StringType | join (const StringType &sep=StringType{", "}) const |
| Join elements into a string with separator. | |
| std::string | join_str (const std::string &sep=", ") const |
| Join string elements with separator. | |
| Container< std::pair< T, typename Other::Item_Type > > | zip_with (const Other &other) const |
| Zip with another container. | |
Public Member Functions inherited from Aleph::KeysMixin< MixinVector< T >, T > | |
| Container< T > | keys () const |
| Extract all keys as a list. | |
| Container< T > | items () const |
| Alias for keys(). | |
Private Attributes | |
| std::vector< T > | data |
Additional Inherited Members | |
Protected Member Functions inherited from Aleph::TraverseMixin< MixinVector< T >, T > | |
| const MixinVector< T > & | self () const noexcept |
| Access the derived class (const version). | |
| MixinVector< T > & | self () noexcept |
| Access the derived class (mutable version). | |
Protected Member Functions inherited from Aleph::LocateMixin< MixinVector< T >, T > | |
| const MixinVector< T > & | self () const noexcept |
| MixinVector< T > & | self () noexcept |
Protected Member Functions inherited from Aleph::FunctionalMixin< MixinVector< T >, T > | |
| const MixinVector< T > & | self () const noexcept |
| MixinVector< T > & | self () noexcept |
Protected Member Functions inherited from Aleph::KeysMixin< MixinVector< T >, T > | |
| const MixinVector< T > & | self () const noexcept |
Simple test container using std::vector internally but with Aleph mixins.
Definition at line 54 of file ah-dry-mixin_test.cc.
| using MixinVector< T >::Item_Type = T |
Definition at line 62 of file ah-dry-mixin_test.cc.
|
default |
|
inline |
Definition at line 65 of file ah-dry-mixin_test.cc.
Definition at line 67 of file ah-dry-mixin_test.cc.
References MixinVector< T >::data.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Definition at line 88 of file ah-dry-mixin_test.cc.
Definition at line 68 of file ah-dry-mixin_test.cc.
References MixinVector< T >::data.
|
inlinenoexcept |
Definition at line 70 of file ah-dry-mixin_test.cc.
References MixinVector< T >::data.
|
inline |
Definition at line 91 of file ah-dry-mixin_test.cc.
References MixinVector< T >::data, and Aleph::FunctionalMixin< MixinVector< T >, T >::maps().
|
inlinenoexcept |
Definition at line 69 of file ah-dry-mixin_test.cc.
References MixinVector< T >::data.
|
private |
Definition at line 59 of file ah-dry-mixin_test.cc.
Referenced by MixinVector< T >::append(), MixinVector< T >::Iterator::get_curr(), MixinVector< T >::Iterator::has_curr(), MixinVector< T >::insert(), MixinVector< T >::is_empty(), MixinVector< T >::operator==(), and MixinVector< T >::size().