|
ORIGINAL
|
A base class for iterable containers that support multiple iteration patterns. More...
#include <iterable.h>


Classes | |
| class | iterAdaptor |
| RAII wrapper for base iterators that provides standard iteration interface. More... | |
Public Types | |
| using | T = std::remove_const_t< TYPE > |
Public Member Functions | |
| iterAdaptor | begin () |
| Returns an iterator adapter pointing to the beginning of the container. | |
| iterAdaptor | end () |
| Returns an iterator adapter pointing to the end sentinel of the container. | |
| iterAdaptor | begin () const |
| Returns a const iterator adapter pointing to the beginning of the container. | |
| iterAdaptor | end () const |
| Returns a const iterator adapter pointing to the end sentinel of the container. | |
| iterAdaptor | first () |
| Returns an iterator adapter pointing to the first element. | |
| iterAdaptor | last () |
| Returns an iterator adapter pointing to the last element. | |
| iterAdaptor | first () const |
| Returns a const iterator adapter pointing to the first element. | |
| iterAdaptor | last () const |
| Returns a const iterator adapter pointing to the last element. | |
| virtual baseIterator< TYPE > * | begins () const =0 |
| Returns the iterator to the beginning of the container. | |
| virtual baseIterator< TYPE > * | ends () const =0 |
| Returns the iterator to the end of the container. | |
| template<typename Callback = transform<TYPE>> requires Operation<Callback, TYPE> | |
| void | forEach (Callback operation=Callback{}) |
| Applies a given operation to each element in the iterable container. | |
| template<typename Callback = transform<TYPE>> requires Operation<Callback, TYPE> | |
| void | forEach (const Callback &operation=Callback{}) const |
| Applies a given operation to each element in the iterable container (const version). | |
| coroutine::generator< T > | generator () const |
| Creates a coroutine generator that yields elements from this container. | |
|
template<typename Callback > requires original::Operation<Callback, TYPE> | |
| auto | forEach (Callback operation) -> void |
|
template<typename Callback > requires original::Operation<Callback, TYPE> | |
| auto | forEach (const Callback &operation) const -> void |
A base class for iterable containers that support multiple iteration patterns.
| TYPE | The type of elements contained in the iterable. |
This class defines the complete iterable container interface with:
The class provides four levels of iteration interface:
Example usage patterns:
| auto original::iterable< TYPE >::begin | ( | ) |
Returns an iterator adapter pointing to the beginning of the container.
Provides standard library-compatible iteration support by:
Example:
| auto original::iterable< TYPE >::begin | ( | ) | const |
Returns a const iterator adapter pointing to the beginning of the container.
Const version of begin() with same RAII and iteration support.
|
pure virtual |
Returns the iterator to the beginning of the container.
This method is used internally by begin(), but can be accessed directly for other purposes. Derived classes should implement this with covariant return types, returning their specific iterator type (which must inherit from baseIterator<TYPE>).
Example:
Implemented in original::array< TYPE, ALLOC >, original::array< original::thread >, original::array< underlying_type, rebind_alloc_underlying >, original::bitSet< ALLOC >, original::blocksList< TYPE, ALLOC >, original::blocksList< TYPE, allocator< TYPE > >, original::chain< TYPE, ALLOC >, original::chain< opts >, original::chain< original::strongPtr< original::filter< TYPE > > >, original::chain< original::strongPtr< original::transform< TYPE > > >, original::chain< original::strongPtr< taskBase >, allocator< original::strongPtr< taskBase > > >, original::chain< TYPE, allocator< TYPE > >, original::forwardChain< TYPE, ALLOC >, original::hashMap< K_TYPE, V_TYPE, HASH, ALLOC >, original::treeMap< K_TYPE, V_TYPE, Compare, ALLOC >, original::JMap< K_TYPE, V_TYPE, Compare, ALLOC >, original::hashSet< TYPE, HASH, ALLOC >, original::treeSet< TYPE, Compare, ALLOC >, original::JSet< TYPE, Compare, ALLOC >, original::vector< TYPE, ALLOC >, original::vector< hashNode *, rebind_alloc_pointer >, original::vector< original::hashTable::hashNode *, rebind_alloc_pointer >, original::vector< original::skipList::skipListNode * >, original::vector< priorityTask, allocator< priorityTask > >, and original::vector< TYPE * >.
| auto original::iterable< TYPE >::end | ( | ) |
Returns an iterator adapter pointing to the end sentinel of the container.
Provides standard library-compatible iteration support by:
Example:
| auto original::iterable< TYPE >::end | ( | ) | const |
Returns a const iterator adapter pointing to the end sentinel of the container.
Const version of end() with same RAII and iteration support.
|
pure virtual |
Returns the iterator to the end of the container.
This method is used internally by end(), but can be accessed directly for other purposes. Derived classes should implement this with covariant return types, returning their specific iterator type (which must inherit from baseIterator<TYPE>).
Example:
Implemented in original::array< TYPE, ALLOC >, original::array< original::thread >, original::array< underlying_type, rebind_alloc_underlying >, original::bitSet< ALLOC >, original::blocksList< TYPE, ALLOC >, original::blocksList< TYPE, allocator< TYPE > >, original::chain< TYPE, ALLOC >, original::chain< opts >, original::chain< original::strongPtr< original::filter< TYPE > > >, original::chain< original::strongPtr< original::transform< TYPE > > >, original::chain< original::strongPtr< taskBase >, allocator< original::strongPtr< taskBase > > >, original::chain< TYPE, allocator< TYPE > >, original::forwardChain< TYPE, ALLOC >, original::hashMap< K_TYPE, V_TYPE, HASH, ALLOC >, original::treeMap< K_TYPE, V_TYPE, Compare, ALLOC >, original::JMap< K_TYPE, V_TYPE, Compare, ALLOC >, original::hashSet< TYPE, HASH, ALLOC >, original::treeSet< TYPE, Compare, ALLOC >, original::JSet< TYPE, Compare, ALLOC >, original::vector< TYPE, ALLOC >, original::vector< hashNode *, rebind_alloc_pointer >, original::vector< original::hashTable::hashNode *, rebind_alloc_pointer >, original::vector< original::skipList::skipListNode * >, original::vector< priorityTask, allocator< priorityTask > >, and original::vector< TYPE * >.
| auto original::iterable< TYPE >::first | ( | ) |
Returns an iterator adapter pointing to the first element.
Provides direct access to the first element without the standard library's past-the-end semantics. Uses RAII through iterAdaptor for automatic memory management.
| auto original::iterable< TYPE >::first | ( | ) | const |
Returns a const iterator adapter pointing to the first element.
Const version of first() with same RAII semantics.
| void original::iterable< TYPE >::forEach | ( | Callback | operation = Callback{} | ) |
Applies a given operation to each element in the iterable container.
| Callback | A callable object that defines the operation to be applied to each element. |
| operation | The operation to be applied. |
Iterates through all elements using first() and applies the operation to each. The operation should accept a TYPE parameter by reference for modification.
Example:
Applies a given operation to each element in the iterable container (const version).
| Callback | A callable object that defines the operation to be applied to each element. |
| operation | The operation to be applied. |
Iterates through all elements using first() and applies the operation to each. The operation should accept a TYPE parameter by value or const reference.
Example:
| original::coroutine::generator< std::remove_const_t< TYPE > > original::iterable< TYPE >::generator | ( | ) | const |
Creates a coroutine generator that yields elements from this container.
This method provides a coroutine-based iteration interface that:
The generator produces std::remove_const_t<TYPE> to ensure compatibility with the underlying alternative<TYPE> storage in coroutines, which requires mutable types for placement new operations.
Example usage:
| auto original::iterable< TYPE >::last | ( | ) |
Returns an iterator adapter pointing to the last element.
Provides direct access to the last element. Uses RAII through iterAdaptor for automatic memory management.
| auto original::iterable< TYPE >::last | ( | ) | const |
Returns a const iterator adapter pointing to the last element.
Const version of last() with same RAII semantics.