PointerArray< T, MINCHUNKSIZE, ALLOCATOR >::IteratorTemplate< CONSTITERATOR > Class Template Reference

#include <pointerarray.h>

Detailed Description

template<typename T, Int MINCHUNKSIZE = BASEARRAY_DEFAULT_CHUNK_SIZE, typename ALLOCATOR = DefaultAllocator>
template<Bool CONSTITERATOR>
class maxon::PointerArray< T, MINCHUNKSIZE, ALLOCATOR >::IteratorTemplate< CONSTITERATOR >

The PointerArray iterator can be used to iterate over an array or parts of it. For more ease of use you may want to invoke this via the C++11 range based for loop.

You can use an iterator almost like a pointer, e.g.

it++; // go to the next element
it--; // go to the previous element
it += 5; // advance by 5 elements
it -= 3; // go back 3 elements
cnt = itB - itA; // number of elements from itA to itB
it = array.Begin(); // iterator to the first element of the array
*it = value; // assign value to the elements referenced by the iterator
value = *value; // get value of the element referenced by the iterator

Public Types

using CollectionType = typename ConstIf< PointerArray, CONSTITERATOR >::type
 
using Type = typename ConstIf< T, CONSTITERATOR >::type
 

Public Member Functions

 IteratorTemplate (CollectionType &a, Int start=0)
 
 IteratorTemplate (Type *const *pos=nullptr)
 
 IteratorTemplate (const IteratorTemplate &src)
 
IteratorTemplateoperator= (const IteratorTemplate &src)
 
 operator ConstIterator & ()
 
 operator Bool () const
 
TypeGetPtr () const
 
Typeoperator* () const
 
Typeoperator-> () const
 
Bool operator== (const IteratorTemplate &b) const
 
Bool operator< (const IteratorTemplate &b) const
 
 MAXON_OPERATOR_COMPARISON (IteratorTemplate)
 
IteratorTemplateoperator++ ()
 
const IteratorTemplate operator++ (int)
 
IteratorTemplateoperator+= (Int i)
 
IteratorTemplateoperator-- ()
 
const IteratorTemplate operator-- (int)
 
IteratorTemplateoperator-= (Int i)
 
IteratorTemplate operator+ (Int i) const
 
IteratorTemplate operator- (Int i) const
 
Int operator- (const IteratorTemplate &b) const
 

Static Public Attributes

static const Bool isLinearIterator
 

Private Attributes

Type *const * _data
 

Member Typedef Documentation

◆ CollectionType

using CollectionType = typename ConstIf<PointerArray, CONSTITERATOR>::type

◆ Type

using Type = typename ConstIf<T, CONSTITERATOR>::type

Constructor & Destructor Documentation

◆ IteratorTemplate() [1/3]

IteratorTemplate ( CollectionType a,
Int  start = 0 
)
explicit

◆ IteratorTemplate() [2/3]

IteratorTemplate ( Type *const *  pos = nullptr)
explicit

◆ IteratorTemplate() [3/3]

IteratorTemplate ( const IteratorTemplate< CONSTITERATOR > &  src)

Member Function Documentation

◆ operator=()

IteratorTemplate& operator= ( const IteratorTemplate< CONSTITERATOR > &  src)

◆ operator ConstIterator &()

operator ConstIterator & ( )

◆ operator Bool()

operator Bool ( ) const
explicit
Returns
true if the iterator points to an element.

◆ GetPtr()

Type* GetPtr ( ) const

◆ operator*()

Type& operator* ( ) const

◆ operator->()

Type* operator-> ( ) const

◆ operator==()

Bool operator== ( const IteratorTemplate< CONSTITERATOR > &  b) const

◆ operator<()

Bool operator< ( const IteratorTemplate< CONSTITERATOR > &  b) const

◆ MAXON_OPERATOR_COMPARISON()

MAXON_OPERATOR_COMPARISON ( IteratorTemplate< CONSTITERATOR >  )

◆ operator++() [1/2]

IteratorTemplate& operator++ ( )

◆ operator++() [2/2]

const IteratorTemplate operator++ ( int  )

◆ operator+=()

IteratorTemplate& operator+= ( Int  i)

◆ operator--() [1/2]

IteratorTemplate& operator-- ( )

◆ operator--() [2/2]

const IteratorTemplate operator-- ( int  )

◆ operator-=()

IteratorTemplate& operator-= ( Int  i)

◆ operator+()

IteratorTemplate operator+ ( Int  i) const

◆ operator-() [1/2]

IteratorTemplate operator- ( Int  i) const

◆ operator-() [2/2]

Int operator- ( const IteratorTemplate< CONSTITERATOR > &  b) const

Member Data Documentation

◆ isLinearIterator

const Bool isLinearIterator
static

◆ _data

Type* const* _data
private