Reference documentation for deal.II version Git c93c00f928 2020-04-01 06:59:45 +0200
\(\newcommand{\vcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\vcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
iterator_range.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2014 - 2019 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 <deal.II/base/template_constraints.h>
23 
24 #include <iterator>
25 
26 
27 DEAL_II_NAMESPACE_OPEN
28 
29 
30 // Forward declaration
31 #ifndef DOXYGEN
32 template <typename Iterator>
34 #endif
35 
36 
128 template <typename Iterator>
130 {
131 public:
136 
137 
141  using iterator = Iterator;
142 
148  IteratorRange();
149 
157  IteratorRange(const iterator begin, const iterator end);
158 
163  begin();
164 
169  begin() const;
170 
176  end() const;
177 
183  end();
184 
185 private:
190  const IteratorOverIterators it_end;
191 };
192 
193 
194 
199 template <typename Iterator>
201 {
202 public:
207  using BaseIterator = Iterator;
208 
216 
221  const BaseIterator &operator*() const;
222 
227  const BaseIterator *operator->() const;
228 
234  operator++();
235 
242  operator++(int);
243 
250  bool
251  operator!=(const IteratorOverIterators &i_o_i) const;
252 
266  operator const BaseIterator &() const;
267 
273  using iterator_category = std::forward_iterator_tag;
274  using value_type = Iterator;
275  using difference_type = typename Iterator::difference_type;
276  using pointer = Iterator *;
277  using reference = Iterator &;
278 
279 private:
284 };
285 
286 
287 
294 template <typename BaseIterator>
296 make_iterator_range(const BaseIterator & begin,
297  const typename identity<BaseIterator>::type &end)
298 {
299  IteratorRange<BaseIterator> ir(begin, end);
300  return ir;
301 }
302 
303 
304 // ------------------- template member functions
305 
306 
307 template <typename Iterator>
309  const BaseIterator &iterator)
310  : element_of_iterator_collection(iterator)
311 {}
312 
313 
314 
315 template <typename Iterator>
316 inline const typename IteratorOverIterators<Iterator>::BaseIterator &
318 {
320 }
321 
322 
323 
324 template <typename Iterator>
325 inline const typename IteratorOverIterators<Iterator>::BaseIterator *
327 {
329 }
330 
331 
332 
333 template <typename Iterator>
336 {
338  return *this;
339 }
340 
341 
342 
343 template <typename Iterator>
346 {
347  const IteratorOverIterators old_value = *this;
349  return *old_value;
350 }
351 
352 
353 
354 template <typename Iterator>
355 inline bool
358 {
360 }
361 
362 
363 
364 template <typename Iterator>
366 {
368 }
369 
370 
371 
372 template <typename Iterator>
374  : it_begin()
375  , it_end()
376 {}
377 
378 
379 
380 template <typename Iterator>
382  const iterator e)
383  : it_begin(b)
384  , it_end(e)
385 {}
386 
387 
388 template <typename Iterator>
391 {
392  return it_begin;
393 }
394 
395 
396 template <typename Iterator>
399 {
400  return it_begin;
401 }
402 
403 
404 template <typename Iterator>
407 {
408  return it_end;
409 }
410 
411 
412 template <typename Iterator>
415 {
416  return it_end;
417 }
418 
419 
420 DEAL_II_NAMESPACE_CLOSE
421 
422 #endif
std::forward_iterator_tag iterator_category
IteratorOverIterators begin()
const BaseIterator & operator*() const
const IteratorOverIterators it_begin
Iterator iterator
IteratorOverIterators & operator++()
const BaseIterator * operator->() const
bool operator!=(const IteratorOverIterators &i_o_i) const
constexpr SymmetricTensor< rank_, dim, Number > operator*(const SymmetricTensor< rank_, dim, Number > &t, const Number &factor)
IteratorOverIterators(const BaseIterator &iterator)
BaseIterator element_of_iterator_collection
::IteratorOverIterators< Iterator > IteratorOverIterators
IteratorOverIterators end() const