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 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). | |
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 three 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< 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< TYPE, allocator< TYPE > >, original::forwardChain< TYPE, ALLOC >, original::hashMap< K_TYPE, V_TYPE, HASH, ALLOC >, original::hashSet< TYPE, HASH, ALLOC >, original::JMap< K_TYPE, V_TYPE, Compare, ALLOC >, original::JSet< TYPE, Compare, ALLOC >, original::treeMap< K_TYPE, V_TYPE, Compare, ALLOC >, original::treeSet< TYPE, Compare, ALLOC >, original::vector< TYPE, ALLOC >, original::vector< hashNode *, rebind_alloc_pointer >, original::vector< hashNode *, rebind_alloc_pointer >, original::vector< original::hashTable::hashNode *, rebind_alloc_pointer >, original::vector< original::skipList::skipListNode * >, 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< 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< TYPE, allocator< TYPE > >, original::forwardChain< TYPE, ALLOC >, original::hashMap< K_TYPE, V_TYPE, HASH, ALLOC >, original::hashSet< TYPE, HASH, ALLOC >, original::JMap< K_TYPE, V_TYPE, Compare, ALLOC >, original::JSet< TYPE, Compare, ALLOC >, original::treeMap< K_TYPE, V_TYPE, Compare, ALLOC >, original::treeSet< TYPE, Compare, ALLOC >, original::vector< TYPE, ALLOC >, original::vector< hashNode *, rebind_alloc_pointer >, original::vector< hashNode *, rebind_alloc_pointer >, original::vector< original::hashTable::hashNode *, rebind_alloc_pointer >, original::vector< original::skipList::skipListNode * >, 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. |
void original::iterable< TYPE >::forEach | ( | const Callback & | operation = Callback{} | ) | const |
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. |
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.