Reference documentation for deal.II version 9.1.0-pre
iterator_range.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2014 - 2018 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.md at
12 // the top level directory of deal.II.
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:
125  {
126  public:
131  using BaseIterator = Iterator;
132 
140 
145  const BaseIterator &operator*() const;
146 
151  const BaseIterator *operator->() const;
152 
158  operator++();
159 
166  operator++(int);
167 
174  bool
175  operator!=(const IteratorOverIterators &i_o_i);
176 
182  using iterator_category = std::forward_iterator_tag;
183  using value_type = Iterator;
184  using difference_type = typename Iterator::difference_type;
185  using pointer = Iterator *;
186  using reference = Iterator &;
187 
188  private:
193  };
194 
195 
199  using iterator = Iterator;
200 
206  IteratorRange();
207 
215  IteratorRange(const iterator begin, const iterator end);
216 
221  begin();
222 
228  end();
229 
230 private:
235  const IteratorOverIterators it_end;
236 };
237 
238 
239 // ------------------- template member functions
240 
241 
242 template <typename Iterator>
244  const BaseIterator &iterator)
246 {}
247 
248 
249 
250 template <typename Iterator>
251 inline const typename IteratorRange<
254 {
256 }
257 
258 
259 
260 template <typename Iterator>
261 inline const typename IteratorRange<
264 {
266 }
267 
268 
269 
270 template <typename Iterator>
273 {
275  return *this;
276 }
277 
278 
279 
280 template <typename Iterator>
283 {
284  const IteratorOverIterators old_value = *this;
286  return *old_value;
287 }
288 
289 
290 
291 template <typename Iterator>
292 inline bool
295 {
297 }
298 
299 
300 template <typename Iterator>
302  : it_begin()
303  , it_end()
304 {}
305 
306 
307 
308 template <typename Iterator>
310  const iterator e)
311  : it_begin(b)
312  , it_end(e)
313 {}
314 
315 
316 template <typename Iterator>
319 {
320  return it_begin;
321 }
322 
323 
324 template <typename Iterator>
327 {
328  return it_end;
329 }
330 
331 
332 DEAL_II_NAMESPACE_CLOSE
333 
334 #endif
IteratorOverIterators begin()
const IteratorOverIterators it_begin
Iterator iterator
IteratorOverIterators end()
IteratorOverIterators & operator++()
const BaseIterator & operator*() const
const BaseIterator * operator->() const
bool operator!=(const IteratorOverIterators &i_o_i)
IteratorOverIterators(const BaseIterator &iterator)
std::forward_iterator_tag iterator_category