20 #ifndef LUNCHBOX_INDEXITERATOR_H    21 #define LUNCHBOX_INDEXITERATOR_H    37 template <
class S, 
class C, 
class T>
    38 class IndexIterator : 
public std::iterator<std::random_access_iterator_tag, T>
    43         : container_(container)
    50         : container_(from.container_)
    56     template <
class U, 
class V, 
class W>
    58         : container_(from.container_)
    67         container_ = rhs.container_;
    69         return *
static_cast<S*
>(
this);
    73     template <
class U, 
class W>
    76         container_ = rhs.container_;
    78         return *
static_cast<S*
>(
this);
    85         return *
static_cast<S*
>(
this);
    92         return *
static_cast<S*
>(
this);
   100     S 
operator+(
const size_t& n)
 const { 
return S(container_, i_ + n); }
   105         return *
static_cast<S*
>(
this);
   109     S 
operator-(
const size_t& n)
 const { 
return S(container_, i_ - n); }
   114         return *
static_cast<S*
>(
this);
   118     ssize_t 
operator-(
const S& n)
 const { 
return i_ - n.i_; }
   122         return container_ == rhs.container_ && i_ == rhs.i_;
   128         return container_ != rhs.container_ || i_ != rhs.i_;
   134         return container_ <= rhs.container_ && i_ < rhs.i_;
   140         return container_ >= rhs.container_ && i_ > rhs.i_;
   149         return container_ <= rhs.container_ && i_ <= rhs.i_;
   158         return container_ >= rhs.container_ && i_ >= rhs.i_;
   168     template <
class, 
class, 
class>
   176 #endif // LUNCHBOX_INDEXITERATOR_H IndexIterator(C *container, const size_t i)
Construct an iterator for a given container and position. 
Counter-based, as opposed to pointer-based, iterator for any container. 
bool operator==(const S &rhs) const 
S operator-(const size_t &n) const 
Decrement the iterator position by a given amount. 
bool operator>(const S &rhs) const 
bool operator>=(const S &rhs) const 
size_t getPosition() const 
S & operator=(const IndexIterator &rhs)
Assign the container and position from another iterator. 
bool operator<=(const S &rhs) const 
ssize_t operator-(const S &n) const 
Compute the distance between this and another iterator. 
S operator++(int)
Increment the iterator position. 
IndexIterator(const S &from)
Copy-construct an iterator. 
S & operator++()
Increment the iterator position. 
S & operator+=(const size_t &n)
Increment the iterator position by a given amount. 
Abstraction layer and common utilities for multi-threaded programming. 
bool operator<(const S &rhs) const 
S & operator-=(const size_t &n)
Decrement the iterator position by a given amount. 
S & operator--()
Decrement the iterator position. 
S operator--(int)
Decrement the iterator position. 
bool operator!=(const S &rhs) const 
S operator+(const size_t &n) const 
Increment the iterator position by a given amount. 
IndexIterator(const IndexIterator< U, V, W > &from)
Copy-construct an iterator. 
S & operator=(const IndexIterator< S, U, W > &rhs)
Assign the container and position from another iterator.