Module: Essential Math Group: Math Collection classes
Does not inherit
template <class T> class RWGenMat<T>::const_iterator;
Class RWGenMat<T>::const_iterator is the random access iterator for the RWGenMat<T> collection class. The const_iterator class behaves like a pointer to type T and is used to increment through elements of an RWGenMat<T>. The const_iterator differs from a plain iterator in that the value of a dereferenced const_iterator may not be changed.
#include <rw/math/genmat.h> int main() { RWGenMat<int> V(5,1); // Create a length 5 matrix
// with all 1's RWGenMat<int>::const_iterator i = V.begin(); RWGenMat<int>::const_iterator stop = V.end(); // print each element of V while(i != stop) { cout << *i << endl; ++i; } }
RWGenMat<T>::const_iterator();
Constructs an iterator that is in an uninitialized state. The iterator must be initialized before it is dereferenced.
RWGenMat<T>::const_iterator (const RWGenMat<T>::const_iterator& i); RWGenMat<T>::const_iterator(const RWGenMat<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 RWGenMat<T>.
RWGenMat<T>::const_iterator& operator++(); RWGenMat<T>::const_iterator& operator--(); RWGenMat<T>::const_iterator& operator++(int); RWGenMat<T>::const_iterator& operator--(int);
Prefix or postfix increment or decrement operator. The const_iterator points to the next or previous element in the RWGenMat<T>. No error condition is set if the const_iterator goes past the bounds of the matrix. Compare to RWGenMat<T>::begin() and RWGenMat<T>::end() to check that the const_iterator position is valid.
RWGenMat<T>::const_iterator& operator+=(RWGenMat<T>::difference_type d); RWGenMat<T>::const_iterator& operator-=(RWGenMat<T>::difference_type d);
The const_iterator is moved forward or backward d elements in the RWGenMat<T>. No error condition is set if the const_iterator goes past the bounds of the matrix. 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 matrix.
RWGenMat<T>::const_iterator& operator=(const RWGenMat<T>::const_iterator& i);
Sets the const_iterator state to be the same state as i.
RWGenMat<T>::difference_type operator-(const RWGenMat<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.
RWGenMat<T>::const_iterator& operator+(RWGenMat<T>::difference_type d) const; RWGenMat<T>::const_iterator& operator-(RWGenMat<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 n elements after self if n is positive, or 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 RWGenMat<T>::const_iterator& i) const; bool operator!=(const RWGenMat<T>::const_iterator& i) const; bool operator<(const RWGenMat<T>::const_iterator& i) const; bool operator>(const RWGenMat<T>::const_iterator& i) const; bool operator<=(const RWGenMat<T>::const_iterator& i) const; bool operator>=(const RWGenMat<T>::const_iterator& i) const;
Comparison operator. Determines relative logical position between two const_iterators, not necessarily the relative memory location of the elements to which it points.
© 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.