Expression Templates Library (ETL)
Public Types | Public Member Functions | List of all members
etl::iterator< Expr > Struct Template Reference

Configurable iterator for ETL expressions. More...

#include <iterator.hpp>

Public Types

using iterator_category = std::random_access_iterator_tag
 
using value_type = value_t< Expr >
 The value type.
 
using reference = decltype(std::declval< Expr >()[i])
 The type of reference.
 
using pointer = std::add_pointer_t< decltype(std::declval< Expr >()[i])>
 The type of pointer.
 
using difference_type = size_t
 The type used for subtracting two iterators.
 

Public Member Functions

 iterator (Expr &expr, size_t i)
 Construct a new iterator. More...
 
reference operator* ()
 Dereference the iterator to get the current value. More...
 
reference operator[] (difference_type n)
 Dereferences the iterator at n forward position. More...
 
auto operator-> ()
 Dereference the iterator to get the current value. More...
 
iteratoroperator-- ()
 Predecrement the iterator. More...
 
iterator operator-- (int)
 Postdecrement the iterator. More...
 
iteratoroperator++ ()
 Preincrement the iterator. More...
 
iterator operator++ (int)
 Postincrement the iterator. More...
 
iteratoroperator+= (difference_type n)
 Advances the iterator n positions. More...
 
iteratoroperator-= (difference_type n)
 Back away the iterator n positions. More...
 
iterator operator+ (difference_type n)
 Creates a new iterator poiting to the current position plus n. More...
 
iterator operator- (difference_type n)
 Creates a new iterator poiting to the current position minus n. More...
 
difference_type operator- (const iterator &it)
 Computes the difference between two iterators. More...
 
bool operator== (const iterator &other) const
 Compare two iterators. More...
 
bool operator!= (const iterator &other) const
 Compare two iterators. More...
 
bool operator> (const iterator &other) const
 Compare two iterators. More...
 
bool operator>= (const iterator &other) const
 Compare two iterators. More...
 
bool operator< (const iterator &other) const
 Compare two iterators. More...
 
bool operator<= (const iterator &other) const
 Compare two iterators. More...
 

Detailed Description

template<typename Expr>
struct etl::iterator< Expr >

Configurable iterator for ETL expressions.

Template Parameters
ExprThe type of expr for which the iterator is working

Constructor & Destructor Documentation

◆ iterator()

template<typename Expr >
etl::iterator< Expr >::iterator ( Expr &  expr,
size_t  i 
)
inline

Construct a new iterator.

Parameters
exprThe expr to iterate over.
iThe starting position

Member Function Documentation

◆ operator!=()

template<typename Expr >
bool etl::iterator< Expr >::operator!= ( const iterator< Expr > &  other) const
inline

Compare two iterators.

Parameters
otherThe other iterator
Returns
true if this operator is not equal to the other iterator

◆ operator*()

template<typename Expr >
reference etl::iterator< Expr >::operator* ( )
inline

Dereference the iterator to get the current value.

Returns
a reference to the current element

◆ operator+()

template<typename Expr >
iterator etl::iterator< Expr >::operator+ ( difference_type  n)
inline

Creates a new iterator poiting to the current position plus n.

Parameters
nThe number of position to advance
Returns
the new interator

◆ operator++() [1/2]

template<typename Expr >
iterator& etl::iterator< Expr >::operator++ ( )
inline

Preincrement the iterator.

Returns
a reference to the iterator

◆ operator++() [2/2]

template<typename Expr >
iterator etl::iterator< Expr >::operator++ ( int  )
inline

Postincrement the iterator.

Returns
an iterator the position prior to the increment.

◆ operator+=()

template<typename Expr >
iterator& etl::iterator< Expr >::operator+= ( difference_type  n)
inline

Advances the iterator n positions.

Parameters
nThe number of position to advance
Returns
a reference to the iterator

◆ operator-() [1/2]

template<typename Expr >
iterator etl::iterator< Expr >::operator- ( difference_type  n)
inline

Creates a new iterator poiting to the current position minus n.

Parameters
nThe number of position to back away
Returns
the new interator

◆ operator-() [2/2]

template<typename Expr >
difference_type etl::iterator< Expr >::operator- ( const iterator< Expr > &  it)
inline

Computes the difference between two iterators.

Parameters
itthe other iterator
Returns
the number of positions between the two iterators

◆ operator--() [1/2]

template<typename Expr >
iterator& etl::iterator< Expr >::operator-- ( )
inline

Predecrement the iterator.

Returns
a reference to the iterator

◆ operator--() [2/2]

template<typename Expr >
iterator etl::iterator< Expr >::operator-- ( int  )
inline

Postdecrement the iterator.

Returns
an iterator the position prior to the decrement.

◆ operator-=()

template<typename Expr >
iterator& etl::iterator< Expr >::operator-= ( difference_type  n)
inline

Back away the iterator n positions.

Parameters
nThe number of position to back
Returns
a reference to the iterator

◆ operator->()

template<typename Expr >
auto etl::iterator< Expr >::operator-> ( )
inline

Dereference the iterator to get the current value.

Returns
a pointer to the current element

◆ operator<()

template<typename Expr >
bool etl::iterator< Expr >::operator< ( const iterator< Expr > &  other) const
inline

Compare two iterators.

Parameters
otherThe other iterator
Returns
true if this operator is less than the other iterator

◆ operator<=()

template<typename Expr >
bool etl::iterator< Expr >::operator<= ( const iterator< Expr > &  other) const
inline

Compare two iterators.

Parameters
otherThe other iterator
Returns
true if this operator is less than or equal to the other iterator

◆ operator==()

template<typename Expr >
bool etl::iterator< Expr >::operator== ( const iterator< Expr > &  other) const
inline

Compare two iterators.

Parameters
otherThe other iterator
Returns
true if this operator is equal to the other iterator

◆ operator>()

template<typename Expr >
bool etl::iterator< Expr >::operator> ( const iterator< Expr > &  other) const
inline

Compare two iterators.

Parameters
otherThe other iterator
Returns
true if this operator is greater than the other iterator

◆ operator>=()

template<typename Expr >
bool etl::iterator< Expr >::operator>= ( const iterator< Expr > &  other) const
inline

Compare two iterators.

Parameters
otherThe other iterator
Returns
true if this operator is greater than or equal to the other iterator

◆ operator[]()

template<typename Expr >
reference etl::iterator< Expr >::operator[] ( difference_type  n)
inline

Dereferences the iterator at n forward position.

Parameters
nThe number of forward position to advance
Returns
a reference to the element at the current position plus n

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