Lunchbox
1.10.0
|
Counter-based, as opposed to pointer-based, iterator for any container. More...
#include <indexIterator.h>
Public Member Functions | |
IndexIterator (C *container, const size_t i) | |
Construct an iterator for a given container and position. More... | |
IndexIterator (const S &from) | |
Copy-construct an iterator. More... | |
template<class U , class V , class W > | |
IndexIterator (const IndexIterator< U, V, W > &from) | |
Copy-construct an iterator. More... | |
S & | operator= (const IndexIterator &rhs) |
Assign the container and position from another iterator. More... | |
template<class U , class W > | |
S & | operator= (const IndexIterator< S, U, W > &rhs) |
Assign the container and position from another iterator. More... | |
S & | operator++ () |
Increment the iterator position. More... | |
S & | operator-- () |
Decrement the iterator position. More... | |
S | operator++ (int) |
Increment the iterator position. More... | |
S | operator-- (int) |
Decrement the iterator position. More... | |
S | operator+ (const size_t &n) const |
Increment the iterator position by a given amount. More... | |
S & | operator+= (const size_t &n) |
Increment the iterator position by a given amount. More... | |
S | operator- (const size_t &n) const |
Decrement the iterator position by a given amount. More... | |
S & | operator-= (const size_t &n) |
Decrement the iterator position by a given amount. More... | |
ssize_t | operator- (const S &n) const |
Compute the distance between this and another iterator. More... | |
bool | operator== (const S &rhs) const |
bool | operator!= (const S &rhs) const |
bool | operator< (const S &rhs) const |
bool | operator> (const S &rhs) const |
bool | operator<= (const S &rhs) const |
bool | operator>= (const S &rhs) const |
size_t | getPosition () const |
Protected Attributes | |
C * | container_ |
size_t | i_ |
Friends | |
template<class , class , class > | |
class | IndexIterator |
Counter-based, as opposed to pointer-based, iterator for any container.
Uses curiously recurring template pattern to return proper type from assignment and other operators. Access methods are to be implemented by a subclass using container_ and i_. Furthermore subclasses need to implement the necessary constructors (see LFVectorIterator for example).
S | CRTP Subclass type |
C | The container type |
T | The element type |
Definition at line 38 of file indexIterator.h.
|
inline |
Construct an iterator for a given container and position.
Definition at line 43 of file indexIterator.h.
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
Definition at line 109 of file indexIterator.h.
|
inline |
Increment the iterator position by a given amount.
Definition at line 86 of file indexIterator.h.
|
inline |
|
inline |
|
inline |
Increment the iterator position by a given amount.
Definition at line 90 of file indexIterator.h.
|
inline |
Decrement the iterator position by a given amount.
Definition at line 94 of file indexIterator.h.
|
inline |
Compute the distance between this and another iterator.
Definition at line 102 of file indexIterator.h.
|
inline |
|
inline |
|
inline |
Decrement the iterator position by a given amount.
Definition at line 98 of file indexIterator.h.
|
inline |
Definition at line 113 of file indexIterator.h.
|
inline |
Definition at line 124 of file indexIterator.h.
|
inline |
Assign the container and position from another iterator.
Definition at line 57 of file indexIterator.h.
|
inline |
Assign the container and position from another iterator.
Definition at line 66 of file indexIterator.h.
|
inline |
|
inline |
Definition at line 117 of file indexIterator.h.
|
inline |
Definition at line 131 of file indexIterator.h.