A range-checked iterator class for memory debugging. More...
#include <Image/CheckedIterator.H>
Public Types | |
typedef T | value_type |
This typedef is used by STL functions. | |
typedef T * | pointer |
This typedef is used by STL functions. | |
typedef T & | reference |
This typedef is used by STL functions. | |
typedef ptrdiff_t | difference_type |
This typedef is used by STL functions. | |
typedef std::random_access_iterator_tag | iterator_category |
This typedef is used by STL functions. | |
Public Member Functions | |
CheckedIterator () | |
Default constructor. | |
CheckedIterator (T *p, T *a, T *b) | |
Constructor. | |
template<class UU > | |
CheckedIterator (const CheckedIterator< UU > &other) | |
Constructor. | |
void | ck_range (const diff_t offset) const |
Pointer arithmetic operators | |
CheckedIterator< T > & | operator++ () |
Pre-increment operator. | |
CheckedIterator< T > | operator++ (int) |
Post-increment operator. | |
CheckedIterator< T > & | operator-- () |
Pre-decrement operator. | |
CheckedIterator< T > | operator-- (int) |
Post-decrement operator. | |
void | operator+= (diff_t d) |
void | operator-= (diff_t d) |
CheckedIterator< T > | operator+ (diff_t d) const |
CheckedIterator< T > | operator- (diff_t d) const |
diff_t | operator- (CheckedIterator< T > other) const |
Comparison operators | |
template<class U > | |
bool | operator== (const CheckedIterator< U > &other) const |
template<class U > | |
bool | operator!= (const CheckedIterator< U > &other) const |
template<class U > | |
bool | operator< (const CheckedIterator< U > &other) const |
template<class U > | |
bool | operator> (const CheckedIterator< U > &other) const |
template<class U > | |
bool | operator<= (const CheckedIterator< U > &other) const |
template<class U > | |
bool | operator>= (const CheckedIterator< U > &other) const |
Dereferencing operators | |
T * | operator-> () const |
T & | operator* () const |
T & | operator[] (diff_t d) const |
Public Attributes | |
T * | ptr |
Pointer to the data. | |
T * | start |
Pointer to the first element we can iterate on. | |
T * | stop |
Pointer to the last element we can iterete on. |
A range-checked iterator class for memory debugging.
A CheckedIterator<T> object exposes essentially the same interface as a T*, but stores a start/stop range that should bound the iterator. This range is checked with a call to ck_range() every time the iterator is derefenced, by either operator*() or operator->().
Definition at line 63 of file CheckedIterator.H.
typedef ptrdiff_t CheckedIterator< T >::difference_type |
This typedef is used by STL functions.
Definition at line 76 of file CheckedIterator.H.
typedef std::random_access_iterator_tag CheckedIterator< T >::iterator_category |
This typedef is used by STL functions.
Definition at line 79 of file CheckedIterator.H.
typedef T* CheckedIterator< T >::pointer |
This typedef is used by STL functions.
Definition at line 70 of file CheckedIterator.H.
typedef T& CheckedIterator< T >::reference |
This typedef is used by STL functions.
Definition at line 73 of file CheckedIterator.H.
typedef T CheckedIterator< T >::value_type |
This typedef is used by STL functions.
Definition at line 67 of file CheckedIterator.H.
CheckedIterator< T >::CheckedIterator | ( | ) | [inline] |
Default constructor.
This builds an iterator with an empty valid range, so a new value must be assigned to the iterator before it can be dereferenced. However, providing a default constructor helps keep source compatibility with non-debug iterators (i.e., raw pointers).
Definition at line 163 of file CheckedIterator.H.
Referenced by CheckedIterator< T >::operator++(), and CheckedIterator< T >::operator--().
CheckedIterator< T >::CheckedIterator | ( | T * | p, | |
T * | a, | |||
T * | b | |||
) | [inline] |
Constructor.
Definition at line 169 of file CheckedIterator.H.
CheckedIterator< T >::CheckedIterator | ( | const CheckedIterator< UU > & | other | ) | [inline] |
Constructor.
Definition at line 175 of file CheckedIterator.H.
CheckedIterator< T > CheckedIterator< T >::operator++ | ( | int | ) | [inline] |
Post-increment operator.
Definition at line 186 of file CheckedIterator.H.
References CheckedIterator< T >::CheckedIterator(), CheckedIterator< T >::ptr, CheckedIterator< T >::start, and CheckedIterator< T >::stop.
CheckedIterator< T > & CheckedIterator< T >::operator++ | ( | ) | [inline] |
Pre-increment operator.
Definition at line 181 of file CheckedIterator.H.
References CheckedIterator< T >::ptr.
CheckedIterator< T > CheckedIterator< T >::operator-- | ( | int | ) | [inline] |
Post-decrement operator.
Definition at line 196 of file CheckedIterator.H.
References CheckedIterator< T >::CheckedIterator(), CheckedIterator< T >::ptr, CheckedIterator< T >::start, and CheckedIterator< T >::stop.
CheckedIterator< T > & CheckedIterator< T >::operator-- | ( | ) | [inline] |
Pre-decrement operator.
Definition at line 191 of file CheckedIterator.H.
References CheckedIterator< T >::ptr.
T* CheckedIterator< T >::ptr |
Pointer to the data.
Definition at line 148 of file CheckedIterator.H.
Referenced by CheckedIterator< T >::operator++(), and CheckedIterator< T >::operator--().
T* CheckedIterator< T >::start |
Pointer to the first element we can iterate on.
Definition at line 151 of file CheckedIterator.H.
Referenced by CheckedIterator< T >::operator++(), and CheckedIterator< T >::operator--().
T* CheckedIterator< T >::stop |
Pointer to the last element we can iterete on.
Definition at line 154 of file CheckedIterator.H.
Referenced by CheckedIterator< T >::operator++(), and CheckedIterator< T >::operator--().