SourcePro® API Reference Guide

 
List of all members | Public Member Functions
RWGenMatIterator< T > Class Template Reference

The random access iterator for the RWGenMat collection class. More...

#include <rw/math/genmat.h>

Inheritance diagram for RWGenMatIterator< T >:
RWGenMatIteratorBase< T >

Public Member Functions

 RWGenMatIterator ()
 
value_typeoperator* () const
 
RWGenMatIterator< T > operator+ (difference_type n) const
 
RWGenMatIterator< T > & operator++ ()
 
RWGenMatIterator< T > operator++ (int)
 
RWGenMatIterator< T > & operator+= (difference_type d)
 
difference_type operator- (const RWGenMatIteratorBase< T > &x) const
 
RWGenMatIterator< T > operator- (difference_type n) const
 
RWGenMatIterator< T > & operator-- ()
 
RWGenMatIterator< T > operator-- (int)
 
RWGenMatIterator< T > & operator-= (difference_type d)
 
pointer operator-> () const
 
value_typeoperator[] (difference_type n) const
 
- Public Member Functions inherited from RWGenMatIteratorBase< T >
bool operator!= (const RWGenMatIteratorBase< T > &x) const
 
bool operator< (const RWGenMatIteratorBase< T > &x) const
 
bool operator<= (const RWGenMatIteratorBase< T > &x) const
 
bool operator== (const RWGenMatIteratorBase< T > &x) const
 
bool operator> (const RWGenMatIteratorBase< T > &x) const
 
bool operator>= (const RWGenMatIteratorBase< T > &x) const
 

Additional Inherited Members

- Public Types inherited from RWGenMatIteratorBase< T >
typedef RWGenMat< T >::const_pointer const_pointer
 
typedef RWGenMat< T >::difference_type difference_type
 
typedef RWGenMat< T >::value_type value_type
 

Detailed Description

template<class T>
class RWGenMatIterator< T >

Class RWGenMatIterator is the random access iterator for the RWGenMat collection class. The RWGenMatIterator class behaves like a pointer to type T, and is used to increment through elements of an RWGenMat.

Note
This class should be accessed as the typedef RWGenMat::iterator.
Example
#include <rw/math/genmat.h>
int main()
{
RWGenMat<int>::iterator i = M.begin();
RWGenMat<int>::iterator stop = M.end();
// Assign a unique int value to each element of M
for (int j=0; i != stop; ++i, ++j) *i = j;
}

Constructor & Destructor Documentation

template<class T >
RWGenMatIterator< T >::RWGenMatIterator ( )
inline

Constructs an iterator that is in an uninitialized state. The iterator must be initialized before it is dereferenced.

Member Function Documentation

template<class T >
value_type& RWGenMatIterator< T >::operator* ( ) const
inline

Returns a reference to the element pointed to by self.

template<class T >
RWGenMatIterator<T> RWGenMatIterator< T >::operator+ ( difference_type  n) const
inline

Returns an RWGenMatIterator that is n elements past or before self.

template<class T >
RWGenMatIterator<T>& RWGenMatIterator< T >::operator++ ( )
inline

Prefix increment operator. The iterator points to the next element in the RWGenMat. No error condition is set if the iterator goes past the bounds of the matrix. Compare to RWGenMat::begin() and RWGenMat::end() to check that the iterator position is valid.

template<class T >
RWGenMatIterator<T> RWGenMatIterator< T >::operator++ ( int  )
inline

Postfix increment operator. The iterator points to the next element in the RWGenMat. No error condition is set if the iterator goes past the bounds of the matrix. Compare to RWGenMat::begin() and RWGenMat::end() to check that the iterator position is valid.

template<class T >
RWGenMatIterator<T>& RWGenMatIterator< T >::operator+= ( difference_type  d)
inline

The RWGenMatIterator is moved forward d elements in the RWGenMat. No error condition is set if the iterator goes past the bounds of the matrix. Incrementing by d and then decrementing by d returns the iterator to its original position, even if doing so takes it past the bounds of the matrix.

template<class T >
difference_type RWGenMatIterator< T >::operator- ( const RWGenMatIteratorBase< T > &  x) const
inline

If the return value is positive, the RWGenMatIterator is that many elements past the RWGenMatIterator x. If the return value is negative, the RWGenMatIterator is that many elements before the RWGenMatIterator x.

template<class T >
RWGenMatIterator<T> RWGenMatIterator< T >::operator- ( difference_type  n) const
inline

Returns an RWGenMatIterator that is n elements past or before self.

template<class T >
RWGenMatIterator<T>& RWGenMatIterator< T >::operator-- ( )
inline

Prefix decrement operator. The iterator points to the previous element in the RWGenMat. No error condition is set if the iterator goes past the bounds of the matrix. Compare to RWGenMat::begin() and RWGenMat::end() to check that the iterator position is valid.

template<class T >
RWGenMatIterator<T> RWGenMatIterator< T >::operator-- ( int  )
inline

Postfix decrement operator. The iterator points to the previous element in the RWGenMat. No error condition is set if the iterator goes past the bounds of the matrix. Compare to RWGenMat::begin() and RWGenMat::end() to check that the iterator position is valid.

template<class T >
RWGenMatIterator<T>& RWGenMatIterator< T >::operator-= ( difference_type  d)
inline

The RWGenMatIterator is moved backward d elements in the RWGenMat. No error condition is set if the iterator goes past the bounds of the matrix. Incrementing by d and then decrementing by d returns the iterator to its original position, even if doing so takes it past the bounds of the matrix.

template<class T >
pointer RWGenMatIterator< T >::operator-> ( ) const
inline

For iterator a, and identifier m, a->m is equivalent to (*a).m.

template<class T >
value_type& RWGenMatIterator< T >::operator[] ( difference_type  n) const
inline

Returns a reference to the element n elements after self if n is positive, or n elements before n if n is negative.

Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.