Module: Essential Math Group: Math Collection classes
Does not inherit
template <class T> class RWMathArray<T>::const_iterator;
Class RWMathArray<T>::const_iterator is the random access iterator for the RWMathArray<T> collection class. The const_iterator class behaves like a pointer to type T and is used to increment through elements of an RWMathArray<T>. The const_iterator differs from a plain iterator in that the value in a dereferenced const_iterator may not be changed.
#include <rw/math/mtharray.h> int main() { RWMathArray<int> A(5,5,5,1); // Create a 5x5x5 array of 1's RWMathArray<int>::const_iterator i = A.begin(); RWMathArray<int>::const_iterator stop = A.end(); // Print each element of A while(i != stop) { cout << *i << endl; ++i; } }
RWMathArray<T>::const_iterator();
Constructs an iterator that is in an uninitialized state. The iterator must be initialized before it is dereferenced.
RWMathArray<T>::const_iterator(const RWMathArray<T>::const_iterator& i); RWMathArray<T>::const_iterator(const RWMathArray<T>::iterator& i);
Constructs a const_iterator from another iterator or const_iterator. Initialized iterators and const_iterators can be obtained via the begin() and end() member functions of RWMathArray<T>.
RWMathArray<T>::const_iterator& operator++(); RWMathArray<T>::const_iterator& operator--(); RWMathArray<T>::const_iterator& operator++(int); RWMathArray<T>::const_iterator& operator--(int);
Prefix or postfix increment or decrement operator. The const_iterator points to the next or previous element in the RWMathArray<T>. No error condition is set if the const_iterator goes past the bounds of the array. Compare to RWMathArray<T>::begin() and RWMathArray<T>::end() to check that the const_iterator position is valid.
RWMathArray<T>::const_iterator& operator+=(RWMathArray<T>::difference_type d); RWMathArray<T>::const_iterator& operator-=(RWMathArray<T>::difference_type d);
The const_iterator is moved forward or backward d elements in the RWMathArray<T>. No error condition is set if the const_iterator goes past the bounds of the array. Incrementing by d and then decrementing by d returns the const_iterator to its original position, even if doing so takes it past the bounds of the array.
RWMathArray<T>::const_iterator& operator=(const RWMathArray<T>::const_iterator& i);
Sets the const_iterator state to be the same state as i.
RWMathArray<T>::difference_type operator-(const RWMathArray<T>::const_iterator& i) const;
If the return value is positive, the const_iterator is that many elements past the const_iterator i. If the return value is negative, the const_iterator is that many elements before the const_iterator i.
RWMathArray<T>::const_iterator& operator+(RWMathArray<T>::difference_type d) const; RWMathArray<T>::const_iterator& operator-(RWMathArray<T>::difference_type d) const;
Returns a const_iterator that is d elements past (or before) self.
const T& operator[]() const;
Returns a reference to the element that is n elements after self if n is positive, or n elements before self if n is negative.
const T& operator*() const;
Returns a reference to the element pointed to by self.
T* operator->() const;
For iterator a, and identifier m, a->m is equivalent to (*a).m.
bool operator==(const RWMathArray<T>::const_iterator& i) const; bool operator!=(const RWMathArray<T>::const_iterator& i) const; bool operator<(const RWMathArray<T>::const_iterator& i) const; bool operator>(const RWMathArray<T>::const_iterator& i) const; bool operator<=(const RWMathArray<T>::const_iterator& i) const; bool operator>=(const RWMathArray<T>::const_iterator& i) const;
Comparison operator. Determines the relative logical position between two const_iterators, not necessarily the relative memory location of the elements to which they point.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.