|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
CRTP Mixin providing element location operations. More...
#include <ah-dry-mixin.H>
Public Member Functions | |
| Type & | nth (const size_t n) |
| Access the n-th element (bounds-checked). | |
| const Type & | nth (const size_t n) 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. | |
| Type & | nth_ne (const size_t n) noexcept |
| Access the n-th element (unchecked). | |
| const Type & | nth_ne (const size_t n) 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. | |
| template<class Operation > requires PredicateWith<Operation &, Type &> | |
| Type * | find_ptr (Operation &operation) |
| Find the first element satisfying a predicate. | |
| template<class Operation > requires PredicateWith<Operation &, const Type &> | |
| const Type * | 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. | |
| template<class Operation > requires PredicateWith<Operation &, const Type &> | |
| const Type * | 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. | |
| template<class Operation > requires PredicateWith<Operation &, Type &> | |
| Type * | 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. | |
| template<class Operation > requires PredicateWith<Operation &, Type &> | |
| std::tuple< bool, Type > | find_item (Operation &operation) |
| Find element with success flag. | |
| template<class Operation > requires PredicateWith<Operation &, Type &> | |
| std::tuple< bool, Type > | 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. | |
| template<class Operation > requires PredicateWith<Operation &, Type &> | |
| std::tuple< bool, Type > | 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. | |
| template<class Operation > requires PredicateWith<Operation &, Type &> | |
| std::tuple< bool, Type > | 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. | |
Protected Member Functions | |
| const Derived & | self () const noexcept |
| Derived & | self () noexcept |
CRTP Mixin providing element location operations.
This mixin adds methods to find and locate elements within a container:
nth() / nth_ne() - access element by indexfind_ptr() - find element matching a predicatefind_item() - find with success flag| Derived | The derived container class (CRTP pattern). |
| Type | The element type stored in the container. |
traverse() method (typically via TraverseMixin).Definition at line 226 of file ah-dry-mixin.H.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 462 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::find_item().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 470 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::find_item().
|
inline |
Find element with success flag.
Like find_ptr() but returns a tuple containing:
| Operation | Callable with signature bool(const Type&). |
| operation | Predicate to test each element. |
Definition at line 444 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::find_ptr(), and Aleph::Type.
Referenced by Aleph::LocateMixin< Derived, Type >::find_item(), Aleph::LocateMixin< Derived, Type >::find_item(), and TEST().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 453 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::find_ptr(), and Aleph::Type.
|
inline |
Find the first element satisfying a predicate.
Searches for the first element where the operation returns true.
| Operation | Callable with signature bool(Type&) or bool(const Type&). |
| operation | Predicate to test each element. |
Definition at line 367 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::self(), and Aleph::Type.
Referenced by Aleph::LocateMixin< Derived, Type >::find_item(), Aleph::LocateMixin< Derived, Type >::find_item(), TEST(), TEST(), and TEST().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Const version.
Definition at line 386 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::self(), and Aleph::Type.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 413 of file ah-dry-mixin.H.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Version accepting rvalue operation.
Definition at line 405 of file ah-dry-mixin.H.
|
inline |
Access the n-th element (bounds-checked).
Returns a reference to the element at position n (0-indexed).
| n | Zero-based index of the element. |
| std::out_of_range | if n >= size(). |
Definition at line 260 of file ah-dry-mixin.H.
References ah_out_of_range_error_if, Aleph::LocateMixin< Derived, Type >::self(), and Aleph::Type.
|
inline |
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.
Definition at line 279 of file ah-dry-mixin.H.
References ah_out_of_range_error_if, Aleph::LocateMixin< Derived, Type >::self(), and Aleph::Type.
|
inlinenoexcept |
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.
Definition at line 326 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::self(), and Aleph::Type.
|
inlinenoexcept |
Access the n-th element (unchecked).
Returns a reference to the element at position n without bounds checking.
| n | Zero-based index of the element. |
Definition at line 310 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::self(), and Aleph::Type.
Referenced by TEST().
|
inlineprotectednoexcept |
Definition at line 229 of file ah-dry-mixin.H.
Referenced by Aleph::LocateMixin< Derived, Type >::find_ptr(), Aleph::LocateMixin< Derived, Type >::find_ptr(), Aleph::LocateMixin< Derived, Type >::nth(), Aleph::LocateMixin< Derived, Type >::nth(), Aleph::LocateMixin< Derived, Type >::nth_ne(), and Aleph::LocateMixin< Derived, Type >::nth_ne().
|
inlineprotectednoexcept |
Definition at line 234 of file ah-dry-mixin.H.