CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
ArrayIterator< Container, Dir > Class Template Reference

Array iterator More...

#include <cc/ArrayIterator>

Public Types

using iterator_category = std::bidirectional_iterator_tag
 
using value_type = typename Container::Item
 
using difference_type = long
 
using pointer = typename Container::Item *
 
using reference = typename Container::Item &
 

Public Member Functions

 ArrayIterator (Container &c, long i)
 Create an array iterator pointing to the i-th item of array c.
 
 operator bool () const
 Check if this iterator is valid (explicitly cast to bool)
 
ArrayIteratorItemAccess< Container >::Type operator* () const
 Get access to current item value.
 
ArrayIteratoroperator++ ()
 Step to the next item and return the old iterator value (postfix increment operator)
 
ArrayIteratoroperator-- ()
 Step to the previous item and return the old iterator value (postfix decrement operator)
 
ArrayIterator operator+ (long delta)
 Get iterator value stepped delta items forward (addition operator)
 
ArrayIterator operator- (long delta)
 Get iterator value stepped delta items backward (substraction operator)
 
int operator- (const ArrayIterator &b) const
 Get distance between this and another iterator (substraction operator)
 
bool operator== (const ArrayIterator &b) const
 Equality operator.
 
std::strong_ordering operator<=> (const ArrayIterator &b) const
 Ordering operator.
 

Detailed Description

template<class Container, long Dir = 1>
class cc::ArrayIterator< Container, Dir >

Array iterator

Template Parameters
ContainerContainer type
DirDirection (1 for forward iterator, -1 for backward iterator)

Constructor & Destructor Documentation

◆ ArrayIterator()

template<class Container , long Dir = 1>
ArrayIterator ( Container & c,
long i )

Create an array iterator pointing to the i-th item of array c.

Member Function Documentation

◆ operator bool()

template<class Container , long Dir = 1>
operator bool ( ) const
explicit

Check if this iterator is valid (explicitly cast to bool)

◆ operator*()

template<class Container , long Dir = 1>
ArrayIteratorItemAccess< Container >::Type operator* ( ) const

Get access to current item value.

◆ operator++()

template<class Container , long Dir = 1>
ArrayIterator & operator++ ( )

Step to the next item and return the old iterator value (postfix increment operator)

◆ operator--()

template<class Container , long Dir = 1>
ArrayIterator & operator-- ( )

Step to the previous item and return the old iterator value (postfix decrement operator)

◆ operator+()

template<class Container , long Dir = 1>
ArrayIterator operator+ ( long delta)

Get iterator value stepped delta items forward (addition operator)

◆ operator-() [1/2]

template<class Container , long Dir = 1>
ArrayIterator operator- ( long delta)

Get iterator value stepped delta items backward (substraction operator)

◆ operator-() [2/2]

template<class Container , long Dir = 1>
int operator- ( const ArrayIterator< Container, Dir > & b) const

Get distance between this and another iterator (substraction operator)

◆ operator==()

template<class Container , long Dir = 1>
bool operator== ( const ArrayIterator< Container, Dir > & b) const

Equality operator.

◆ operator<=>()

template<class Container , long Dir = 1>
std::strong_ordering operator<=> ( const ArrayIterator< Container, Dir > & b) const

Ordering operator.