AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::IteratorBase< IterType, PosType > Class Template Reference

Base class for a random access iterator over positions in a set. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/core/IteratorBase.hpp>

Inheritance diagram for axom::IteratorBase< IterType, PosType >:

Protected Member Functions

 IteratorBase ()
 
AXOM_HOST_DEVICE IteratorBase (PosType pos)
 

Protected Attributes

PosType m_pos
 

Equality and relational operators

using iterator = IteratorBase< IterType, PosType >
 
bool operator== (const iterator &lhs, const iterator &rhs)
 Equality operator. More...
 
AXOM_HOST_DEVICE friend bool operator!= (const iterator &lhs, const iterator &rhs)
 Inequality operator. More...
 
bool operator< (const iterator &lhs, const iterator &rhs)
 Less than operator. More...
 
bool operator<= (const iterator &lhs, const iterator &rhs)
 Less than or equal operator. More...
 
bool operator> (const iterator &lhs, const iterator &rhs)
 Greater than operator. More...
 
bool operator>= (const iterator &lhs, const iterator &rhs)
 Greater than or equal operator. More...
 

Iterator advance and distance operators

IterType operator+ (const IterType &it, PosType n)
 Addition operator with iterator on left and position on right. More...
 
IterType operator+ (PosType n, const IterType &it)
 Addition operator with position on left and iterator on right. More...
 
IterType operator- (const IterType &it, PosType n)
 Subtraction operator with iterator on left and position on right. More...
 
IterType operator- (PosType n, const IterType &it)
 Subtraction operator with position on left and iterator on right. More...
 
PosType operator- (const IterType &a, const IterType &b)
 Difference operator. More...
 
AXOM_HOST_DEVICE IterType & operator++ ()
 Pre-increment operator. More...
 
IterType operator++ (int)
 Post-increment operator. More...
 
IterType & operator-- ()
 Pre-decrement operator. More...
 
IterType operator-- (int)
 Post-decrement operator. More...
 
IterType & operator+= (PosType n)
 Addition-assignment operator. More...
 
IterType & operator-= (PosType n)
 Subtraction-assignment operator. More...
 

Detailed Description

template<typename IterType, typename PosType>
class axom::IteratorBase< IterType, PosType >

Base class for a random access iterator over positions in a set.

This class is for keeping track of the position value in an iterator class. It uses the Curiously Recurring Template Pattern (CRTP): The first template parameter should be the actual iterator class.
The derived iterator class must implement void advance(PositionType) to update the m_pos variable. e.g.

class IteratorDerived : public IteratorBase < IteratorDerived, PositionType >
{
//...implementation of the accessing functions using m_pos...
//derive iterator class must implement this function, ideally protected.
protected:
void advance( PositionType n) {...}
};
PosType m_pos
Definition: IteratorBase.hpp:213
IteratorBase()
Definition: IteratorBase.hpp:53
Template Parameters
IterTypeThe iterator class to be the derived class
PosTypeThe type used to index into the iterator Must be a signed integral type

Member Typedef Documentation

◆ iterator

template<typename IterType , typename PosType >
using axom::IteratorBase< IterType, PosType >::iterator = IteratorBase<IterType, PosType>

Constructor & Destructor Documentation

◆ IteratorBase() [1/2]

template<typename IterType , typename PosType >
axom::IteratorBase< IterType, PosType >::IteratorBase ( )
inlineprotected

◆ IteratorBase() [2/2]

template<typename IterType , typename PosType >
AXOM_HOST_DEVICE axom::IteratorBase< IterType, PosType >::IteratorBase ( PosType  pos)
inlineexplicitprotected

Member Function Documentation

◆ operator++() [1/2]

template<typename IterType , typename PosType >
AXOM_HOST_DEVICE IterType& axom::IteratorBase< IterType, PosType >::operator++ ( )
inline

Pre-increment operator.

◆ operator++() [2/2]

template<typename IterType , typename PosType >
IterType axom::IteratorBase< IterType, PosType >::operator++ ( int  )
inline

Post-increment operator.

◆ operator--() [1/2]

template<typename IterType , typename PosType >
IterType& axom::IteratorBase< IterType, PosType >::operator-- ( )
inline

Pre-decrement operator.

◆ operator--() [2/2]

template<typename IterType , typename PosType >
IterType axom::IteratorBase< IterType, PosType >::operator-- ( int  )
inline

Post-decrement operator.

◆ operator+=()

template<typename IterType , typename PosType >
IterType& axom::IteratorBase< IterType, PosType >::operator+= ( PosType  n)
inline

Addition-assignment operator.

◆ operator-=()

template<typename IterType , typename PosType >
IterType& axom::IteratorBase< IterType, PosType >::operator-= ( PosType  n)
inline

Subtraction-assignment operator.

Friends And Related Function Documentation

◆ operator==

template<typename IterType , typename PosType >
bool operator== ( const iterator lhs,
const iterator rhs 
)
friend

Equality operator.

◆ operator!=

template<typename IterType , typename PosType >
AXOM_HOST_DEVICE friend bool operator!= ( const iterator lhs,
const iterator rhs 
)
friend

Inequality operator.

◆ operator<

template<typename IterType , typename PosType >
bool operator< ( const iterator lhs,
const iterator rhs 
)
friend

Less than operator.

◆ operator<=

template<typename IterType , typename PosType >
bool operator<= ( const iterator lhs,
const iterator rhs 
)
friend

Less than or equal operator.

◆ operator>

template<typename IterType , typename PosType >
bool operator> ( const iterator lhs,
const iterator rhs 
)
friend

Greater than operator.

◆ operator>=

template<typename IterType , typename PosType >
bool operator>= ( const iterator lhs,
const iterator rhs 
)
friend

Greater than or equal operator.

◆ operator+ [1/2]

template<typename IterType , typename PosType >
IterType operator+ ( const IterType &  it,
PosType  n 
)
friend

Addition operator with iterator on left and position on right.

◆ operator+ [2/2]

template<typename IterType , typename PosType >
IterType operator+ ( PosType  n,
const IterType &  it 
)
friend

Addition operator with position on left and iterator on right.

◆ operator- [1/3]

template<typename IterType , typename PosType >
IterType operator- ( const IterType &  it,
PosType  n 
)
friend

Subtraction operator with iterator on left and position on right.

◆ operator- [2/3]

template<typename IterType , typename PosType >
IterType operator- ( PosType  n,
const IterType &  it 
)
friend

Subtraction operator with position on left and iterator on right.

◆ operator- [3/3]

template<typename IterType , typename PosType >
PosType operator- ( const IterType &  a,
const IterType &  b 
)
friend

Difference operator.

Member Data Documentation

◆ m_pos

template<typename IterType , typename PosType >
PosType axom::IteratorBase< IterType, PosType >::m_pos
protected

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