30 #ifndef __CLAW_IT_INDEX_HPP__ 31 #define __CLAW_IT_INDEX_HPP__ 46 typedef typename std::iterator_traits<T>::value_type value_type;
47 typedef typename std::iterator_traits<T>::difference_type difference_type;
48 typedef typename std::iterator_traits<T>::pointer pointer;
49 typedef typename std::iterator_traits<T>::reference reference;
81 , m_index(that.m_index)
89 void set(
const T& it,
int index)
95 bool operator<(const it_index<T>& that)
const 97 return m_index < that.m_index;
100 bool operator<(
const T& it)
const 104 bool operator<(
int index)
const 106 return m_index < index;
109 bool operator<=(const it_index<T>& that)
const 111 return (*
this < that) || (*
this == that);
113 bool operator<=(
const T& it)
const 117 bool operator<=(
int index)
const 119 return m_index <= index;
122 bool operator>(
const it_index<T>& that)
const 124 return m_index > that.m_index;
126 bool operator>(
const T& it)
const 130 bool operator>(
int index)
const 132 return m_index > index;
135 bool operator>=(
const it_index<T>& that)
const 137 return (*
this > that) || (*
this == that);
139 bool operator>=(
const T& it)
const 143 bool operator>=(
int index)
const 145 return m_index >= index;
148 bool operator==(
const it_index<T>& that)
const 150 return (m_it == that.m_it) && (m_index == that.m_index);
152 bool operator==(
const T& it)
const 156 bool operator==(
int index)
const 158 return m_index == index;
161 bool operator!=(
const it_index<T>& that)
const 163 return !(*
this == *that);
165 bool operator!=(
const T& it)
const 169 bool operator!=(
int index)
const 171 return m_index != index;
174 it_index<T> operator+(
int index)
const 176 return it_index<T>(m_it + index, m_index + index);
178 it_index<T> operator-(
int index)
const 180 return it_index<T>(m_it - index, m_index - index);
182 it_index<T> operator*(
int index)
const 184 return it_index<T>(m_it + (index - 1) * m_index, m_index * index);
186 it_index<T> operator/(
int index)
const 188 return it_index<T>(m_it - (m_index - m_index / index), m_index / index);
191 reference operator*()
const 195 pointer operator->()
const 201 it_index<T>& operator++()
209 it_index<T> operator++(
int)
211 it_index<T> r(*
this);
217 it_index<T>& operator--()
225 it_index<T> operator--(
int)
227 it_index<T> r(*
this);
232 it_index<T>& operator+=(
int index)
239 it_index<T>& operator-=(
int index)
246 it_index<T>& operator*=(
int index)
248 m_it += (index - 1) * m_index;
253 it_index<T>& operator/=(
int index)
255 m_it -= m_index - m_index / index;
273 #endif // __CLAW_IT_INDEX_HPP__
it_index(const it_index< T > &that)
Copy constructor.
it_index(const T &it, int index=0)
Constructor.
A class to manage an index and an iterator easily.
This is the main namespace.