Calico
|
An iterator adapter that counts the offset as the iterator moves. More...
#include <iterator.hpp>
Public Types | |
typedef Distance | difference_type |
Difference type (also used for counting). | |
typedef std::iterator_traits < iterator_type > ::iterator_category | iterator_category |
Iterator category. | |
typedef Iterator | iterator_type |
Underlying iterator type. | |
typedef std::iterator_traits < iterator_type >::pointer | pointer |
Pointer type. | |
typedef std::iterator_traits < iterator_type >::reference | reference |
Reference type. | |
typedef std::iterator_traits < iterator_type >::value_type | value_type |
Value type. | |
Public Member Functions | |
counted_iterator () | |
Default initializes the iterator with an unspecified counter value. | |
counted_iterator (const iterator_type &iterator, difference_type init_count=difference_type()) | |
Constructs a counted_iterator with an initial count. More... | |
const iterator_type & | base () const |
Returns the underlying iterator. | |
difference_type | count () const |
Returns the current value of the counter. | |
operator iterator_type () const | |
Returns the underlying iterator. | |
reference | operator* () const |
Returns the pointed-to object. | |
counted_iterator | operator++ (int) |
Post-increments the underlying iterator and the counter. | |
counted_iterator & | operator++ () |
Pre-increments the underlying iterator and the counter. | |
template<class N > | |
counted_iterator & | operator+= (N n) |
Advances both the underlying iterator and the counter by n . | |
counted_iterator & | operator-- () |
Pre-decrements the underlying iterator and the counter. | |
counted_iterator | operator-- (int) |
Post-decrements the underlying iterator and the counter. | |
template<class N > | |
counted_iterator & | operator-= (N n) |
Advances both the underlying iterator and the counter by n in reverse. | |
pointer | operator-> () const |
Member access of the object pointed to by the iterator. | |
void | set_count (difference_type value) |
Sets the current value of the counter. | |
An iterator adapter that counts the offset as the iterator moves.
Iterator | An iterator type to be wrapped. The adapter supports all kinds of iterators. |
Distance | The type used to count the iterations. Defaults to the difference_type of the Iterator . |
|
inline |
Constructs a counted_iterator
with an initial count.
iterator | The iterator to be wrapped. |
init_count | The initial count. |