SourcePro® API Reference Guide

Product Documentation:
   SourcePro
Documentation Home
List of all members | Public Member Functions
RWMathVecConstIterator< T > Class Template Reference

The const random access iterator for the RWMathVec collection class. More...

#include <rw/math/mathvec.h>

Inheritance diagram for RWMathVecConstIterator< T >:
RWMathVecIteratorBase< T >

Public Member Functions

 RWMathVecConstIterator ()
 
 RWMathVecConstIterator (const RWMathVecConstIterator< T > &x)
 
 RWMathVecConstIterator (const RWMathVecIterator< T > &x)
 
const value_type & operator* () const
 
RWMathVecConstIterator< T > operator+ (difference_type d) const
 
RWMathVecConstIterator< T > & operator++ ()
 
RWMathVecConstIterator< T > operator++ (int)
 
RWMathVecConstIterator< T > & operator+= (difference_type d)
 
difference_type operator- (const RWMathVecIteratorBase< T > &i) const
 
RWMathVecConstIterator< T > operator- (difference_type d) const
 
RWMathVecConstIterator< T > & operator-- ()
 
RWMathVecConstIterator< T > operator-- (int)
 
RWMathVecConstIterator< T > & operator-= (difference_type d)
 
const_pointer operator-> () const
 
RWMathVecConstIteratoroperator= (const RWMathVecConstIterator< T > &x)
 
const value_type & operator[] (difference_type n) const
 
- Public Member Functions inherited from RWMathVecIteratorBase< T >
bool operator!= (const RWMathVecIteratorBase< T > &x) const
 
bool operator< (const RWMathVecIteratorBase< T > &x) const
 
bool operator<= (const RWMathVecIteratorBase< T > &x) const
 
bool operator== (const RWMathVecIteratorBase< T > &x) const
 
bool operator> (const RWMathVecIteratorBase< T > &x) const
 
bool operator>= (const RWMathVecIteratorBase< T > &x) const
 

Detailed Description

template<class T>
class RWMathVecConstIterator< T >

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

Note
This class should be used through RWMathVec::const_iterator.
Example
#include <rw/math/mathvec.h>
int main()
{
RWMathVec<int> V(5,1); // Create a length 5 vector of 1's
// Print each element of V
while(i != stop) {
cout << *i << endl;
++i;
}
}

Constructor & Destructor Documentation

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

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

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

Constructs a RWMathVecConstIterator from another RWMathVecConstIterator. Initialized RWMathVecConstIterator can be obtained via the RWMathVec::begin() and RWMathVec::end().

template<class T >
RWMathVecConstIterator< T >::RWMathVecConstIterator ( const RWMathVecIterator< T > &  x)
inline

Constructs a RWMathVecConstIterator from another RWMathVecIterator. Initialized RWMathVecIterator can be obtained via the RWMathVec::begin() and RWMathVec::end().

Member Function Documentation

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

Returns a reference to the element pointed to by self.

template<class T >
RWMathVecConstIterator<T> RWMathVecConstIterator< T >::operator+ ( difference_type  d) const
inline

Returns a RWMathVecConstIterator that is d elements past self.

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

Prefix or postfix increment or decrement operator. The RWMathVecConstIterator points to the next or previous element in the RWMathVec. No error condition is set if the RWMathVecConstIterator goes past the bounds of the vector. Compare to RWMathVec::begin() and RWMathVec::end() to check that the RWMathVecConstIterator position is valid.

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

Prefix or postfix increment or decrement operator. The RWMathVecConstIterator points to the next or previous element in the RWMathVec. No error condition is set if the RWMathVecConstIterator goes past the bounds of the vector. Compare to RWMathVec::begin() and RWMathVec::end() to check that the RWMathVecConstIterator position is valid.

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

Moves the RWMathVecConstIterator forward or backward d elements in the RWMathVec. No error condition is set if the RWMathVecConstIterator goes past the bounds of the vector. Incrementing by d and then decrementing by d returns the RWMathVecConstIterator to its original position, even if doing so takes it past the bounds of the vector.

template<class T >
difference_type RWMathVecConstIterator< T >::operator- ( const RWMathVecIteratorBase< T > &  i) const
inline

If the return value is positive, sets the RWMathVecConstIterator that many elements past the RWMathVecConstIterator i. If the return value is negative, sets the RWMathVecConstIterator that many elements before the RWMathVecConstIterator i.

template<class T >
RWMathVecConstIterator<T> RWMathVecConstIterator< T >::operator- ( difference_type  d) const
inline

Returns a RWMathVecConstIterator that is d elements before self.

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

Prefix or postfix increment or decrement operator. The RWMathVecConstIterator points to the next or previous element in the RWMathVec. No error condition is set if the RWMathVecConstIterator goes past the bounds of the vector. Compare to RWMathVec::begin() and RWMathVec::end() to check that the RWMathVecConstIterator position is valid.

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

Prefix or postfix increment or decrement operator. The RWMathVecConstIterator points to the next or previous element in the RWMathVec. No error condition is set if the RWMathVecConstIterator goes past the bounds of the vector. Compare to RWMathVec::begin() and RWMathVec::end() to check that the RWMathVecConstIterator position is valid.

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

Moves the RWMathVecConstIterator forward or backward d elements in the RWMathVec. No error condition is set if the RWMathVecConstIterator goes past the bounds of the vector. Incrementing by d and then decrementing by d returns the RWMathVecConstIterator to its original position, even if doing so takes it past the bounds of the vector.

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

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

template<class T >
RWMathVecConstIterator& RWMathVecConstIterator< T >::operator= ( const RWMathVecConstIterator< T > &  x)
inline

Replaces the current iterator position with x. Initialized iterators can be obtained via the RWMathVec::begin() and RWMathVec::end() member functions.

template<class T >
const value_type& RWMathVecConstIterator< 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 self if n is negative.

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