|
Aleph-w 3.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) const |
| Access the n-th element (bounds-checked). | |
| Type & | nth_ne (const size_t n) const noexcept |
| Access the n-th element (unchecked). | |
| template<class Operation > | |
| Type * | find_ptr (Operation &operation) |
| Find the first element satisfying a predicate. | |
| template<class Operation > | |
| 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 > | |
| 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 > | |
| 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 > | |
| std::tuple< bool, Type > | find_item (Operation &operation) |
| Find element with success flag. | |
| template<class Operation > | |
| 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 > | |
| 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 > | |
| 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 222 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 416 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::find_item(), and Aleph::maps().
|
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 423 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::find_item(), and Aleph::maps().
|
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 400 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::find_ptr(), and Aleph::maps().
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 408 of file ah-dry-mixin.H.
References Aleph::LocateMixin< Derived, Type >::find_ptr(), and Aleph::maps().
|
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 327 of file ah-dry-mixin.H.
References Aleph::maps(), Aleph::LocateMixin< Derived, Type >::self(), and GenericTraverse< Container >::traverse().
Referenced by Aleph::LocateMixin< Derived, Type >::find_item(), Aleph::LocateMixin< Derived, Type >::find_item(), 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 345 of file ah-dry-mixin.H.
References Aleph::maps(), Aleph::LocateMixin< Derived, Type >::self(), and GenericTraverse< Container >::traverse().
|
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 370 of file ah-dry-mixin.H.
References Aleph::maps().
|
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 363 of file ah-dry-mixin.H.
References Aleph::maps().
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 256 of file ah-dry-mixin.H.
References ah_out_of_range_error_if, Aleph::maps(), Aleph::LocateMixin< Derived, Type >::self(), and GenericTraverse< Container >::traverse().
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 287 of file ah-dry-mixin.H.
References Aleph::maps(), Aleph::LocateMixin< Derived, Type >::self(), and GenericTraverse< Container >::traverse().
Referenced by TEST().
|
inlineprotectednoexcept |
Definition at line 225 of file ah-dry-mixin.H.
References Aleph::maps().
Referenced by Aleph::LocateMixin< Derived, Type >::find_ptr(), Aleph::LocateMixin< Derived, Type >::find_ptr(), Aleph::LocateMixin< Derived, Type >::nth(), and Aleph::LocateMixin< Derived, Type >::nth_ne().
|
inlineprotectednoexcept |
Definition at line 230 of file ah-dry-mixin.H.
References Aleph::maps().