SourcePro® API Reference Guide

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

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

#include <rw/math/mtharray.h>

Inheritance diagram for RWMathArrayConstIterator< T >:
RWMathArrayIteratorBase< T >

Public Member Functions

 RWMathArrayConstIterator ()
 
 RWMathArrayConstIterator (const RWMathArrayIteratorBase< T > &i)
 
const value_typeoperator* () const
 
RWMathArrayConstIterator operator+ (difference_type d) const
 
RWMathArrayConstIteratoroperator++ ()
 
RWMathArrayConstIterator operator++ (int)
 
RWMathArrayConstIteratoroperator+= (difference_type d)
 
difference_type operator- (const RWMathArrayIteratorBase< T > &i) const
 
RWMathArrayConstIterator operator- (difference_type d) const
 
RWMathArrayConstIteratoroperator-- ()
 
RWMathArrayConstIterator operator-- (int)
 
RWMathArrayConstIteratoroperator-= (difference_type d)
 
const_pointer operator-> () const
 
RWMathArrayConstIterator< T > & operator= (const RWMathArrayIteratorBase< T > &x)
 
const value_typeoperator[] (difference_type n) const
 
- Public Member Functions inherited from RWMathArrayIteratorBase< T >
bool operator!= (const RWMathArrayIteratorBase< T > &x) const
 
bool operator< (const RWMathArrayIteratorBase< T > &x) const
 
bool operator<= (const RWMathArrayIteratorBase< T > &x) const
 
bool operator== (const RWMathArrayIteratorBase< T > &x) const
 
bool operator> (const RWMathArrayIteratorBase< T > &x) const
 
bool operator>= (const RWMathArrayIteratorBase< T > &x) const
 

Additional Inherited Members

- Public Types inherited from RWMathArrayIteratorBase< T >
typedef RWMathArray< T >::const_pointer const_pointer
 
typedef RWMathArray< T >::difference_type difference_type
 
typedef RWMathArray< T >::value_type value_type
 

Detailed Description

template<class T>
class RWMathArrayConstIterator< T >

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

Synopsis
template <class T>
Example
#include <rw/math/mtharray.h>
int main()
{
RWMathArray<int> A(5,5,5,1); // Create a 5x5x5 array of 1's
// Print each element of A
while(i != stop) {
cout << *i << endl;
++i;
}
}

Constructor & Destructor Documentation

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

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

template<class T >
RWMathArrayConstIterator< T >::RWMathArrayConstIterator ( const RWMathArrayIteratorBase< T > &  i)
inline

Constructs a RWMathArrayConstIterator from another RWMathArrayIterator or RWMathArrayConstIterator. Initialized RWMathArrayIterator and RWMathArrayConstIterator instances can be obtained via the RWMathArray::begin() and RWMathArray::end() member functions of RWMathArray.

Member Function Documentation

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

Returns a reference to the element pointed to by self.

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

Returns a RWMathArrayConstIterator that is d elements past (or before) self.

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

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

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

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

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

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

template<class T >
difference_type RWMathArrayConstIterator< T >::operator- ( const RWMathArrayIteratorBase< T > &  i) const
inline

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

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

Returns a RWMathArrayConstIterator that is d elements past (or before) self.

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

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

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

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

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

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

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

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

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

Sets the RWMathArrayConstIterator state to be the same state as i.

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

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.

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