SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
The random access iterator for the RWMathArray<T> collection class. More...
#include <rw/math/mtharray.h>
Public Types | |
typedef RWMathArray< T > ::difference_type | difference_type |
typedef RWMathArray< T > ::value_type | value_type |
typedef RWMathArray< T > ::const_pointer | const_pointer |
Public Member Functions | |
RWMathArrayConstIterator () | |
RWMathArrayConstIterator (const RWMathArrayIteratorBase< T > &i) | |
RWMathArrayConstIterator & | operator++ () |
RWMathArrayConstIterator & | operator-- () |
RWMathArrayConstIterator | operator++ (int) |
RWMathArrayConstIterator | operator-- (int) |
RWMathArrayConstIterator< T > & | operator= (const RWMathArrayIteratorBase< T > &x) |
RWMathArrayConstIterator & | operator+= (difference_type d) |
RWMathArrayConstIterator & | operator-= (difference_type d) |
difference_type | operator- (const RWMathArrayIteratorBase< T > &i) const |
RWMathArrayConstIterator | operator- (difference_type d) const |
RWMathArrayConstIterator | operator+ (difference_type d) const |
const value_type & | operator[] (difference_type n) const |
const value_type & | operator* () const |
const_pointer | operator-> () const |
Class RWMathArray<T> is the random access iterator for the RWMathArray<T> collection class. The RWMathArrayConstIterator class behaves like a pointer to type T and is used to increment through elements of an RWMathArray<T> . The RWMathArrayConstIterator differs from a plain iterator in that the value in a dereferenced RWMathArrayConstIterator may not be changed.
template <class T> class RWMathArray<T>::const_iterator;
#include <rw/math/mtharray.h> int main() { RWMathArray<int> A(5,5,5,1); // Create a 5x5x5 array of 1's RWMathArray<int>::const_iterator i = A.begin(); RWMathArray<int>::const_iterator stop = A.end(); // Print each element of A while(i != stop) { cout << *i << endl; ++i; } }
typedef RWMathArray<T>::const_pointer RWMathArrayConstIterator< T >::const_pointer |
Typedef for a const pointer to a value in this container.
Reimplemented from RWMathArrayIteratorBase< T >.
typedef RWMathArray<T>::difference_type RWMathArrayConstIterator< T >::difference_type |
Typedef for the type of result from subtracting two iterators obtained from this container.
Reimplemented from RWMathArrayIteratorBase< T >.
typedef RWMathArray<T>::value_type RWMathArrayConstIterator< T >::value_type |
Typedef for the type of elements in this container.
Reimplemented from RWMathArrayIteratorBase< T >.
RWMathArrayConstIterator< T >::RWMathArrayConstIterator | ( | ) | [inline] |
Constructs an iterator that is in an uninitialized state. The iterator must be initialized before it is dereferenced.
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<T>::begin() and RWMathArray<T>::end() member functions of RWMathArray<T> .
const value_type& RWMathArrayConstIterator< T >::operator* | ( | ) | const [inline] |
Returns a reference to the element pointed to by self.
RWMathArrayConstIterator RWMathArrayConstIterator< T >::operator+ | ( | difference_type | d | ) | const [inline] |
Returns a RWMathArrayConstIterator that is d elements past (or before) self.
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<T> . No error condition is set if the RWMathArrayConstIterator goes past the bounds of the array. Compare to RWMathArray<T>::begin() and RWMathArray<T>::end() to check that the RWMathArrayConstIterator position is valid.
RWMathArrayConstIterator& RWMathArrayConstIterator< T >::operator++ | ( | ) | [inline] |
Prefix or postfix increment or decrement operator. The RWMathArrayConstIterator points to the next or previous element in the RWMathArray<T> . No error condition is set if the RWMathArrayConstIterator goes past the bounds of the array. Compare to RWMathArray<T>::begin() and RWMathArray<T>::end() to check that the RWMathArrayConstIterator position is valid.
RWMathArrayConstIterator& RWMathArrayConstIterator< T >::operator+= | ( | difference_type | d | ) | [inline] |
The RWMathArrayConstIterator is moved forward or backward d elements in the RWMathArray<T> . 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.
RWMathArrayConstIterator RWMathArrayConstIterator< T >::operator- | ( | difference_type | d | ) | const [inline] |
Returns a RWMathArrayConstIterator that is d elements past (or before) self.
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.
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<T> . No error condition is set if the RWMathArrayConstIterator goes past the bounds of the array. Compare to RWMathArray<T>::begin() and RWMathArray<T>::end() to check that the RWMathArrayConstIterator position is valid.
RWMathArrayConstIterator& RWMathArrayConstIterator< T >::operator-- | ( | ) | [inline] |
Prefix or postfix increment or decrement operator. The RWMathArrayConstIterator points to the next or previous element in the RWMathArray<T> . No error condition is set if the RWMathArrayConstIterator goes past the bounds of the array. Compare to RWMathArray<T>::begin() and RWMathArray<T>::end() to check that the RWMathArrayConstIterator position is valid.
RWMathArrayConstIterator& RWMathArrayConstIterator< T >::operator-= | ( | difference_type | d | ) | [inline] |
The RWMathArrayConstIterator is moved forward or backward d elements in the RWMathArray<T> . 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.
const_pointer RWMathArrayConstIterator< T >::operator-> | ( | ) | const [inline] |
For iterator a, and identifier m, a->m is equivalent to (*a).m.
RWMathArrayConstIterator<T>& RWMathArrayConstIterator< T >::operator= | ( | const RWMathArrayIteratorBase< T > & | x | ) | [inline] |
Sets the RWMathArrayConstIterator state to be the same state as i.
Reimplemented from RWMathArrayIteratorBase< 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 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.