ROSE 0.11.145.147
|
Bidirectional forward iterator.
This iterator can be incremented, decremented, or dereferenced unless it is already at the end, as determined by its atEnd predicate or by comparison with any other iterator whose atEnd is true, including a default-constructed iterator. An iterator is considered to be at its end if it has been incremented past the interval's greatest value or decremented past the interval's least value. Iterators will operate safely even when the least or greatest value of the range is the least or greatest possible value that can be represented in type T and incrementing or decrementing would cause an overflow. This is acheived by pretending that there's an extra value one less than the interval's least value and one greater than the intervals greatest value, regardless of whether such values exist for type T. Incrementing an iterator that's positioned one past the interval's greatest is a no-op, as is decrementing an iterator positioned one prior to the interval's least end. On the other hand, decrementing an iterator positioned one past the interval's greatest end positions the iterator at greatest and clears its atEnd property; similarly, incrementing an iterator positioned one prior to the interval's least end positions the iterator at the least value.
Definition at line 74 of file Interval.h.
#include <Sawyer/Interval.h>
Public Member Functions | |
ConstIterator () | |
Create an empty iterator. | |
bool | atEnd () const |
Predicate to determine if an iterator is at one of its end positions. | |
|
inline |
Create an empty iterator.
All increment and decrement operators are no-ops and atEnd always returns true. It is illegal to attempt to dereference such an iterator. A default-constructed iterator compares equal to all other default-constructed iterators and equal to all iterators positioned at one of their ends.
Definition at line 89 of file Interval.h.
|
inline |
Predicate to determine if an iterator is at one of its end positions.
Returns true if this iterator is positioned one prior to the interval's least end, or one after the interval's greatest end. These two positions are virtual and exist even if type T is unable to represent them. Since intervals are immutable, their iterators' end-points are defined when the iterator is created and are constant.
Definition at line 96 of file Interval.h.