31#ifndef __CLAW_ITERATOR_HPP__
32#define __CLAW_ITERATOR_HPP__
43 template<
typename Category,
typename Value,
typename Iterator,
55 template<
typename Value,
typename Iterator,
typename Function>
57 <std::forward_iterator_tag, Value, Iterator, Function>
60 typedef typename std::iterator_traits<Iterator>::difference_type
62 typedef Value value_type;
63 typedef value_type* pointer;
64 typedef value_type& reference;
65 typedef typename std::iterator_traits<Iterator>::iterator_category
70 <std::forward_iterator_tag, Value, Iterator, Function>
81 template<
typename C,
typename V,
typename I,
typename F>
84 : m_it(that.get_iterator()), m_fun(that.get_function())
87 const Iterator& get_iterator()
const {
return m_it; }
88 const Function& get_function()
const {
return m_fun; }
103 reference operator*()
const {
return m_fun(*m_it); }
104 pointer operator->()
const {
return &m_fun(*m_it); }
106 bool operator==(
const self_type& that )
const {
return m_it == that.m_it; }
107 bool operator!=(
const self_type& that )
const {
return m_it != that.m_it; }
108 bool operator==(
const Iterator& it )
const {
return m_it == it; }
109 bool operator!=(
const Iterator& it )
const {
return m_it != it; }
126 template<
typename Value,
typename Iterator,
typename Function>
128 <std::bidirectional_iterator_tag, Value, Iterator, Function>
131 typedef typename std::iterator_traits<Iterator>::difference_type
133 typedef Value value_type;
134 typedef value_type* pointer;
135 typedef value_type& reference;
136 typedef typename std::iterator_traits<Iterator>::iterator_category
141 <std::bidirectional_iterator_tag, Value, Iterator, Function>
self_type;
151 template<
typename C,
typename V,
typename I,
typename F>
154 : m_it(that.get_iterator()), m_fun(that.get_function())
157 const Iterator& get_iterator()
const {
return m_it; }
158 const Function& get_function()
const {
return m_fun; }
186 reference operator*()
const {
return m_fun(*m_it); }
187 pointer operator->()
const {
return &m_fun(*m_it); }
189 bool operator==(
const self_type& that )
const {
return m_it == that.m_it; }
190 bool operator!=(
const self_type& that )
const {
return m_it != that.m_it; }
191 bool operator==(
const Iterator& it )
const {
return m_it == it; }
192 bool operator!=(
const Iterator& it )
const {
return m_it != it; }
208 template<
typename Value,
typename Iterator,
typename Function>
210 <std::random_access_iterator_tag, Value, Iterator, Function>
213 typedef typename std::iterator_traits<Iterator>::difference_type
215 typedef Value value_type;
216 typedef value_type* pointer;
217 typedef value_type& reference;
218 typedef typename std::iterator_traits<Iterator>::iterator_category
223 <std::random_access_iterator_tag, Value, Iterator, Function>
234 template<
typename V,
typename I>
237 <std::random_access_iterator_tag, V, I, Function>& that )
238 : m_it(that.m_it), m_fun(that.m_fun)
240 template<
typename C,
typename V,
typename I,
typename F>
243 : m_it(that.get_iterator()), m_fun(that.get_function())
246 const Iterator& get_iterator()
const {
return m_it; }
247 const Function& get_function()
const {
return m_fun; }
275 reference operator*()
const {
return m_fun(*m_it); }
276 pointer operator->()
const {
return &m_fun(*m_it); }
278 bool operator==(
const self_type& that )
const {
return m_it == that.m_it; }
279 bool operator!=(
const self_type& that )
const {
return m_it != that.m_it; }
280 bool operator==(
const Iterator& it )
const {
return m_it == it; }
281 bool operator!=(
const Iterator& it )
const {
return m_it != it; }
282 bool operator<(
const self_type& that )
const {
return m_it < that.m_it; }
283 bool operator<=(
const self_type& that )
const {
return m_it <= that.m_it; }
284 bool operator>(
const self_type& that )
const {
return m_it > that.m_it; }
285 bool operator>=(
const self_type& that )
const {
return m_it >= that.m_it; }
287 difference_type operator-(
const self_type& that )
const
289 return m_it - that.m_it;
305 self_type& operator-=(
int n) {
return *
this += -n; }
314 reference operator[](
int n) {
return m_fun(m_it[n]); }
325 template<
typename Value,
typename Iterator,
typename Function>
327 <std::random_access_iterator_tag, Value, Iterator, Function>
331 < std::random_access_iterator_tag, Value, Iterator, Function >& it )
336 template<
typename Value,
typename Iterator,
typename Function>
337 wrapped_iterator_by_category
338 <std::random_access_iterator_tag, Value, Iterator, Function>
341 const wrapped_iterator_by_category
342 < std::random_access_iterator_tag, Value, Iterator, Function >& it )
360 template <
typename Value,
typename Iterator,
typename Function>
366 <
typename std::iterator_traits<Iterator>::iterator_category,
367 Value, Iterator, Function >
Base class for wrapped iterators, specialized for bidirectional iterators.
Base class for wrapped iterators, specialized for forward iterators.
Base class for wrapped iterators, specialized for random iterators.
Base class for wrapped iterators.
This class defines an iterator resulting of the appliance of a function to an effective iterator.
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.
claw::graphic::image::base_iterator< ImageT, PixelT >::self_type operator+(int n, const typename claw::graphic::image::base_iterator< ImageT, PixelT >::self_type &self)
Get an iterator at a specific distance of the current iterator.
This is the main namespace.