30 #ifndef __CLAW_ITERATOR_HPP__ 31 #define __CLAW_ITERATOR_HPP__ 41 template <
typename Category,
typename Value,
typename Iterator,
50 template <
typename Value,
typename Iterator,
typename Function>
55 typedef typename std::iterator_traits<Iterator>::difference_type
57 typedef Value value_type;
58 typedef value_type* pointer;
59 typedef value_type& reference;
60 typedef typename std::iterator_traits<Iterator>::iterator_category
77 template <
typename C,
typename V,
typename I,
typename F>
80 : m_it(that.get_iterator())
81 , m_fun(that.get_function())
84 const Iterator& get_iterator()
const 88 const Function& get_function()
const 106 reference operator*()
const 110 pointer operator->()
const 112 return &m_fun(*m_it);
115 bool operator==(
const self_type& that)
const 117 return m_it == that.m_it;
119 bool operator!=(
const self_type& that)
const 121 return m_it != that.m_it;
123 bool operator==(
const Iterator& it)
const 127 bool operator!=(
const Iterator& it)
const 146 template <
typename Value,
typename Iterator,
typename Function>
151 typedef typename std::iterator_traits<Iterator>::difference_type
153 typedef Value value_type;
154 typedef value_type* pointer;
155 typedef value_type& reference;
156 typedef typename std::iterator_traits<Iterator>::iterator_category
160 Value, Iterator, Function>
173 template <
typename C,
typename V,
typename I,
typename F>
176 : m_it(that.get_iterator())
177 , m_fun(that.get_function())
180 const Iterator& get_iterator()
const 184 const Function& get_function()
const 215 reference operator*()
const 219 pointer operator->()
const 221 return &m_fun(*m_it);
224 bool operator==(
const self_type& that)
const 226 return m_it == that.m_it;
228 bool operator!=(
const self_type& that)
const 230 return m_it != that.m_it;
232 bool operator==(
const Iterator& it)
const 236 bool operator!=(
const Iterator& it)
const 254 template <
typename Value,
typename Iterator,
typename Function>
259 typedef typename std::iterator_traits<Iterator>::difference_type
261 typedef Value value_type;
262 typedef value_type* pointer;
263 typedef value_type& reference;
264 typedef typename std::iterator_traits<Iterator>::iterator_category
268 Value, Iterator, Function>
281 template <
typename V,
typename I>
288 template <
typename C,
typename V,
typename I,
typename F>
291 : m_it(that.get_iterator())
292 , m_fun(that.get_function())
295 const Iterator& get_iterator()
const 299 const Function& get_function()
const 330 reference operator*()
const 334 pointer operator->()
const 336 return &m_fun(*m_it);
339 bool operator==(
const self_type& that)
const 341 return m_it == that.m_it;
343 bool operator!=(
const self_type& that)
const 345 return m_it != that.m_it;
347 bool operator==(
const Iterator& it)
const 351 bool operator!=(
const Iterator& it)
const 355 bool operator<(
const self_type& that)
const 357 return m_it < that.m_it;
359 bool operator<=(
const self_type& that)
const 361 return m_it <= that.m_it;
363 bool operator>(
const self_type& that)
const 365 return m_it > that.m_it;
367 bool operator>=(
const self_type& that)
const 369 return m_it >= that.m_it;
372 difference_type operator-(
const self_type& that)
const 374 return m_it - that.m_it;
402 reference operator[](
int n)
404 return m_fun(m_it[n]);
416 template <
typename Value,
typename Iterator,
typename Function>
421 Value, Iterator, Function>& it)
426 template <
typename Value,
typename Iterator,
typename Function>
427 wrapped_iterator_by_category<std::random_access_iterator_tag, Value,
430 const wrapped_iterator_by_category<std::random_access_iterator_tag,
431 Value, Iterator, Function>& it)
448 template <
typename Value,
typename Iterator,
typename Function>
454 typename std::iterator_traits<Iterator>::iterator_category, Value,
461 #endif // __CLAW_ITERATOR_HPP__ wrapped_iterator_by_category< typename std::iterator_traits< Iterator >::iterator_category, Value, Iterator, Function > iterator_type
This is the type of the iterator that you want.
Base class for wrapped iterators, specialized for forward iterators.
Base class for wrapped iterators, specialized for random iterators.
This class defines an iterator resulting of the appliance of a function to an effective iterator...
Base class for wrapped iterators.
This is the main namespace.
Base class for wrapped iterators, specialized for bidirectional iterators.