#include <autoiterator.h>
Public Types | |
typedef Int | ForEachIteratorMarker |
Private Types | |
typedef Select< ::std::is_const< C >::value, typename C::ConstIterator, typename C::Iterator >::Type | Iterator |
Private Attributes | |
Iterator | _it |
const Iterator | _end |
Iterator helper template.
C | Class with an valid Iterator. This templates simplifies cases like iterating over a whole array or list. Typical usage is: |
When iterating from the last to the first element you have to take into account that End() is one after the last element. Therefore you have to write:
Other than that the AutoIterator behaves like the iterator it encapsulates and you can do all sorts of iterator arithmetic that the base iterator supports, e.g.
|
private |
typedef Int ForEachIteratorMarker |
This marker indicates that an AutoIterator supports the protocol of the FOREACH macro.
|
explicit |
Use this constructor if you want to iterate over all elements. Please note that the end iterator of the AutoArray is a constant. When you modify an array (via Insert(), Append() or Erase()) the value of its End() iterator will most likely change and trying to iterate over such an array with an AutoIterator while modifying it would crash.
|
explicit |
use this constructor if you want to iterate from s until e (excluding e)
|
explicit |
AutoIterator | ( | const AutoIterator< C > & | src | ) |
AutoIterator& operator= | ( | const AutoIterator< C > & | src | ) |
Bool HasValue | ( | ) | const |
Operator that returns false when the end of the array has been reached. operator bool() would be ambiguous because it can be used for integer arithmetic. For C++0x we use explicit bool to avoid that implicit conversion, for older compilers void* is returned because you can't do arithmetic with it.
Iterator::ValueType* GetPtr | ( | ) | const |
Iterator::ValueType& operator* | ( | ) | const |
Iterator::ValueType* operator-> | ( | ) | const |
Bool operator== | ( | const AutoIterator< C > & | b | ) | const |
Bool operator!= | ( | const AutoIterator< C > & | b | ) | const |
Bool operator>= | ( | const AutoIterator< C > & | b | ) | const |
Bool operator<= | ( | const AutoIterator< C > & | b | ) | const |
Bool operator< | ( | const AutoIterator< C > & | b | ) | const |
Bool operator> | ( | const AutoIterator< C > & | b | ) | const |
AutoIterator& operator++ | ( | ) |
const AutoIterator operator++ | ( | int | ) |
AutoIterator& operator+= | ( | Int | i | ) |
AutoIterator& operator-- | ( | ) |
const AutoIterator operator-- | ( | int | ) |
AutoIterator& operator-= | ( | Int | i | ) |
AutoIterator operator+ | ( | Int | i | ) | const |
AutoIterator operator- | ( | Int | i | ) | const |
Int operator- | ( | const AutoIterator< C > & | b | ) | const |
operator Iterator | ( | ) | const |
|
private |
|
private |