Reference documentation for deal.II version 9.0.0
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 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:
125  {
126  public:
131  typedef Iterator BaseIterator;
132 
140 
145  BaseIterator operator* () const;
146 
151  const BaseIterator *operator-> () const;
152 
158 
165 
172  bool operator != (const IteratorOverIterators &i_o_i);
173 
179  typedef std::forward_iterator_tag iterator_category;
180  typedef Iterator value_type;
181  typedef typename Iterator::difference_type difference_type;
182  typedef Iterator *pointer;
183  typedef Iterator &reference;
184 
185  private:
190  };
191 
192 
196  typedef Iterator iterator;
197 
203  IteratorRange();
204 
213  const iterator end);
214 
219 
225 
226 private:
231  const iterator it_end;
232 };
233 
234 
235 // ------------------- template member functions
236 
237 
238 template <typename Iterator>
239 inline
242  :
243  element_of_iterator_collection (iterator)
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  return &element_of_iterator_collection;
264 }
265 
266 
267 
268 template <typename Iterator>
269 inline
272 {
273  ++element_of_iterator_collection;
274  return *this;
275 }
276 
277 
278 
279 template <typename Iterator>
280 inline
283 {
284  const IteratorOverIterators old_value = *this;
285  ++element_of_iterator_collection;
286  return *old_value;
287 }
288 
289 
290 
291 template <typename Iterator>
292 inline
293 bool
295 {
296  return element_of_iterator_collection != i_o_i.element_of_iterator_collection;
297 }
298 
299 
300 template <typename Iterator>
301 inline
303  :
304  it_begin(),
305  it_end()
306 {}
307 
308 
309 
310 template <typename Iterator>
311 inline
313  const iterator e)
314  :
315  it_begin(b),
316  it_end(e)
317 {}
318 
319 
320 template <typename Iterator>
321 inline
324 {
325  return IteratorOverIterators(it_begin);
326 }
327 
328 
329 template <typename Iterator>
330 inline
333 {
334  return IteratorOverIterators(it_end);
335 }
336 
337 
338 DEAL_II_NAMESPACE_CLOSE
339 
340 #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
std::forward_iterator_tag iterator_category