56 class wrapped_iterator_by_category
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
69 wrapped_iterator_by_category
70 <std::forward_iterator_tag, Value, Iterator, Function>
74 wrapped_iterator_by_category() {}
75 wrapped_iterator_by_category(
const Iterator& it )
78 wrapped_iterator_by_category(
const Iterator& it,
const Function& f )
81 template<
typename C,
typename V,
typename I,
typename F>
82 wrapped_iterator_by_category
83 (
const wrapped_iterator_by_category<C, V, I, F>& that )
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; }
90 self_type& operator++()
96 self_type operator++(
int)
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; }
127 class wrapped_iterator_by_category
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
140 wrapped_iterator_by_category
141 <std::bidirectional_iterator_tag, Value, Iterator, Function> self_type;
144 wrapped_iterator_by_category() {}
145 wrapped_iterator_by_category(
const Iterator& it )
148 wrapped_iterator_by_category(
const Iterator& it,
const Function& f )
151 template<
typename C,
typename V,
typename I,
typename F>
152 wrapped_iterator_by_category
153 (
const wrapped_iterator_by_category<C, V, I, F>& that )
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; }
160 self_type& operator++()
166 self_type operator++(
int)
168 self_type tmp(*
this);
173 self_type& operator--()
179 self_type operator--(
int)
181 self_type tmp(*
this);
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; }
209 class wrapped_iterator_by_category
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
222 wrapped_iterator_by_category
223 <std::random_access_iterator_tag, Value, Iterator, Function>
227 wrapped_iterator_by_category() {}
228 wrapped_iterator_by_category(
const Iterator& it )
231 wrapped_iterator_by_category(
const Iterator& it,
const Function& f )
234 template<
typename V,
typename I>
235 wrapped_iterator_by_category
236 (
const wrapped_iterator_by_category
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>
241 wrapped_iterator_by_category
242 (
const wrapped_iterator_by_category<C, V, I, F>& that )
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; }
249 self_type& operator++()
255 self_type operator++(
int)
257 self_type tmp(*
this);
262 self_type& operator--()
268 self_type operator--(
int)
270 self_type tmp(*
this);
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;
292 self_type& operator+=(
int n)
298 self_type operator+(
int n)
const
300 self_type result(*
this);
305 self_type& operator-=(
int n) {
return *
this += -n; }
307 self_type operator-(
int n)
const
309 self_type result(*
this);
314 reference operator[](
int n) {
return m_fun(m_it[n]); }
327 <std::random_access_iterator_tag, Value, Iterator, Function>
331 < std::random_access_iterator_tag, Value, Iterator, Function >& it )
338 <std::random_access_iterator_tag, Value, Iterator, Function>
342 < std::random_access_iterator_tag, Value, Iterator, Function >& it )
wrapped_iterator_by_category< typename std::iterator_traits< file_content::const_iterator >::iterator_category, constfile_content::key_type, file_content::const_iterator, const_pair_first< file_content::value_type > > iterator_type