SourcePro® API Reference Guide

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

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

#include <rw/math/genmat.h>

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

Public Member Functions

 RWGenMatConstIterator ()
 
 RWGenMatConstIterator (const RWGenMatIteratorBase< T > &x)
 
const value_typeoperator* () const
 
RWGenMatConstIterator< T > operator+ (difference_type n) const
 
RWGenMatConstIterator< T > & operator++ ()
 
RWGenMatConstIterator< T > operator++ (int)
 
RWGenMatConstIterator< T > & operator+= (difference_type d)
 
difference_type operator- (const RWGenMatIteratorBase< T > &x) const
 
RWGenMatConstIterator< T > operator- (difference_type n) const
 
RWGenMatConstIterator< T > & operator-- ()
 
RWGenMatConstIterator< T > operator-- (int)
 
RWGenMatConstIterator< T > & operator-= (difference_type d)
 
const_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 RWGenMatConstIterator< T >

Class RWGenMatConstIterator is the random access iterator for the RWGenMat collection class. The RWGenMatConstIterator class behaves like a pointer to type T and is used to increment through elements of an RWGenMat. The RWGenMatConstIterator differs from a plain RWGenMatIterator in that the value of a dereferenced RWGenMatConstIterator may not be changed.

Note
This class should be accessed as the typedef RWGenMat::const_iterator.
Example
#include <iostream>
#include <rw/math/genmat.h>
int main()
{
RWGenMat<int> V(5,1); // Create a length 5 matrix
// with all 1's
// print each element of V
while(i != stop) {
std::cout << *i << std::endl;
++i;
}
}

Constructor & Destructor Documentation

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

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

template<class T >
RWGenMatConstIterator< T >::RWGenMatConstIterator ( const RWGenMatIteratorBase< T > &  x)
inline

Constructs a RWGenMatConstIterator from another RWGenMatIterator or RWGenMatConstIterator. Initialized RWGenMatIterator and RWGenMatConstIterator instances can be obtained via the RWGenMat::begin() and RWGenMat::end() member functions of RWGenMat.

Member Function Documentation

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

Returns a reference to the element pointed to by self.

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

Returns a RWGenMatConstIterator that is n elements past (or before) self.

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

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

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

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

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

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

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

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

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

Returns a RWGenMatConstIterator that is n elements past (or before) self.

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

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

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

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

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

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

template<class T >
const_pointer RWGenMatConstIterator< T >::operator-> ( )
inline

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

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

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

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