ORIGINAL
Loading...
Searching...
No Matches
original::iterable< TYPE > Class Template Referenceabstract

A base class for iterable containers that support iterators. More...

#include <iterable.h>

Inheritance diagram for original::iterable< TYPE >:
Inheritance graph
Collaboration diagram for original::iterable< TYPE >:
Collaboration graph

Classes

class  iterAdaptor
 An iterator adapter for the iterable container. More...
 

Public Member Functions

iterAdaptor begin ()
 Returns an iterator pointing to the beginning of the iterable container.
 
iterAdaptor end ()
 Returns an iterator pointing to the end of the iterable container.
 
iterAdaptor begin () const
 Returns a constant iterator pointing to the beginning of the iterable container.
 
iterAdaptor end () const
 Returns a constant iterator pointing to the end of the iterable container.
 
iterAdaptor first ()
 Returns an iterator pointing to the first element.
 
iterAdaptor last ()
 Returns an iterator pointing to the last element.
 
iterAdaptor first () const
 Returns a constant iterator pointing to the first element.
 
iterAdaptor last () const
 Returns a constant iterator 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
 

Detailed Description

template<typename TYPE>
class original::iterable< TYPE >

A base class for iterable containers that support iterators.

Template Parameters
TYPEThe type of elements contained in the iterable.

This class defines the iterable container interface, which provides methods for obtaining iterators and applying operations on elements using iterators. It also supports iteration using C++ range-based for loops by providing begin() and end() methods.

Member Function Documentation

◆ begin() [1/2]

template<typename TYPE>
auto original::iterable< TYPE >::begin ( )

Returns an iterator pointing to the beginning of the iterable container.

Returns
An iterator to the first element.

This function allows using the range-based for loop syntax.

◆ begin() [2/2]

template<typename TYPE>
auto original::iterable< TYPE >::begin ( ) const

Returns a constant iterator pointing to the beginning of the iterable container.

Returns
A constant iterator to the first element.

This function allows using the range-based for loop syntax.

◆ begins()

◆ end() [1/2]

template<typename TYPE>
auto original::iterable< TYPE >::end ( )

Returns an iterator pointing to the end of the iterable container.

Returns
An iterator to one past the last element.

This function allows using the range-based for loop syntax.

◆ end() [2/2]

template<typename TYPE>
auto original::iterable< TYPE >::end ( ) const

Returns a constant iterator pointing to the end of the iterable container.

Returns
A constant iterator to one past the last element.

This function allows using the range-based for loop syntax.

◆ ends()

◆ first() [1/2]

template<typename TYPE>
auto original::iterable< TYPE >::first ( )

Returns an iterator pointing to the first element.

Returns
An iterator to the first element.

◆ first() [2/2]

template<typename TYPE>
auto original::iterable< TYPE >::first ( ) const

Returns a constant iterator pointing to the first element.

Returns
A constant iterator to the first element.

◆ forEach() [1/2]

template<typename TYPE>
template<typename Callback = transform<TYPE>>
requires Operation<Callback, TYPE>
void original::iterable< TYPE >::forEach ( Callback operation = Callback{})

Applies a given operation to each element in the iterable container.

Template Parameters
CallbackA callable object that defines the operation to be applied to each element.
Parameters
operationThe operation to be applied.

◆ forEach() [2/2]

template<typename TYPE>
template<typename Callback = transform<TYPE>>
requires Operation<Callback, TYPE>
void original::iterable< TYPE >::forEach ( const Callback & operation = Callback{}) const

Applies a given operation to each element in the iterable container (const version).

Template Parameters
CallbackA callable object that defines the operation to be applied to each element.
Parameters
operationThe operation to be applied.

◆ last() [1/2]

template<typename TYPE>
auto original::iterable< TYPE >::last ( )

Returns an iterator pointing to the last element.

Returns
An iterator to the last element.

◆ last() [2/2]

template<typename TYPE>
auto original::iterable< TYPE >::last ( ) const

Returns a constant iterator pointing to the last element.

Returns
A constant iterator to the last element.

The documentation for this class was generated from the following file: