Reference documentation for deal.II version 8.5.1
iterator_range.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2014 - 2015 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__iterator_range_h
17 #define dealii__iterator_range_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <iterator>
23 
24 
25 DEAL_II_NAMESPACE_OPEN
26 
27 
116 template <typename Iterator>
118 {
119 public:
124  class IteratorOverIterators : public std::iterator<std::forward_iterator_tag, Iterator,
125  typename Iterator::difference_type>
126  {
127  public:
132  typedef Iterator BaseIterator;
133 
141 
146  BaseIterator operator* () const;
147 
152  const BaseIterator *operator-> () const;
153 
159 
166 
173  bool operator != (const IteratorOverIterators &i_o_i);
174 
175  private:
180  };
181 
182 
186  typedef Iterator iterator;
187 
193  IteratorRange();
194 
203  const iterator end);
204 
209 
215 
216 private:
221  const iterator it_end;
222 };
223 
224 
225 // ------------------- template member functions
226 
227 
228 template <typename Iterator>
229 inline
232  :
233  element_of_iterator_collection (iterator)
234 {}
235 
236 
237 
238 template <typename Iterator>
239 inline
242 {
243  return element_of_iterator_collection;
244 }
245 
246 
247 
248 template <typename Iterator>
249 inline
252 {
253  return &element_of_iterator_collection;
254 }
255 
256 
257 
258 template <typename Iterator>
259 inline
262 {
263  ++element_of_iterator_collection;
264  return *this;
265 }
266 
267 
268 
269 template <typename Iterator>
270 inline
273 {
274  const IteratorOverIterators old_value = *this;
275  ++element_of_iterator_collection;
276  return *old_value;
277 }
278 
279 
280 
281 template <typename Iterator>
282 inline
283 bool
285 {
286  return element_of_iterator_collection != i_o_i.element_of_iterator_collection;
287 }
288 
289 
290 template <typename Iterator>
291 inline
293  :
294  it_begin(),
295  it_end()
296 {}
297 
298 
299 
300 template <typename Iterator>
301 inline
303  const iterator e)
304  :
305  it_begin(b),
306  it_end(e)
307 {}
308 
309 
310 template <typename Iterator>
311 inline
314 {
315  return IteratorOverIterators(it_begin);
316 }
317 
318 
319 template <typename Iterator>
320 inline
323 {
324  return IteratorOverIterators(it_end);
325 }
326 
327 
328 DEAL_II_NAMESPACE_CLOSE
329 
330 #endif
const BaseIterator * operator->() const
IteratorOverIterators begin()
IteratorOverIterators end()
IteratorOverIterators & operator++()
Iterator iterator
bool operator!=(const IteratorOverIterators &i_o_i)
IteratorOverIterators(const BaseIterator &iterator)
const iterator it_begin