Iterators

The collection classes in the Essential Math Module provide iterators that are compatible with the Standard C++ Library Module. An iterator is simply a pointer-like object used to cycle through all the elements stored in a collection class. Each collection class in the Essential Math Module can generate random access iterators. The collection classes and their generated iterator classes are listed in Table 326:

Table 326. The Essential Math Module iterator classes

Collection Class

Generated Iterator Classes

RWMathVec<T>

RWMathVec<T>::iterator

RWMathVec<T>::const_iterator

RWGenMat<T>

RWGenMat<T>::iterator

RWGenMat<T>::const_iterator

RWMathArray<T>

RWMathArray<T>::iterator

RWMathArray<T>::const_iterator

As you can see, iterators come in two varieties: iterator and const_iterator. The distinction is that a dereferenced iterator returns a pointer, while a const_iterator returns a const pointer. This means that the value referenced by a const_iterator may not be altered. Iterator classes are described in detail in the SourcePro API Reference.

In this section: