deal.II version GIT relicensing-2114-gd9582acac8 2024-11-06 19:20:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
iterator_range.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2014 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_iterator_range_h
16#define dealii_iterator_range_h
17
18
19#include <deal.II/base/config.h>
20
22
24
25
26// Forward declaration
27#ifndef DOXYGEN
28template <typename Iterator>
30#endif
31
32
124template <typename Iterator>
126{
127public:
132
133
137 using iterator = Iterator;
138
145
154
159 begin();
160
165 begin() const;
166
172 end() const;
173
179 end();
180
181private:
187};
188
189
190
195template <typename Iterator>
197{
198public:
203 using BaseIterator = Iterator;
204
211 explicit IteratorOverIterators(const BaseIterator &iterator);
212
217 const BaseIterator &
218 operator*() const;
219
224 const BaseIterator *
225 operator->() const;
226
232 operator++();
233
240 operator++(int);
241
248 bool
250
264 operator const BaseIterator &() const;
265
271 using iterator_category = std::forward_iterator_tag;
272 using value_type = Iterator;
273 using difference_type = typename Iterator::difference_type;
274 using pointer = Iterator *;
275 using reference = Iterator &;
276
277private:
282};
283
284
285
290template <typename BaseIterator>
294{
296 return ir;
297}
298
299
300// ------------------- template member functions
301
302
303template <typename Iterator>
305 const BaseIterator &iterator)
306 : element_of_iterator_collection(iterator)
307{}
308
309
310
311template <typename Iterator>
314{
315 return element_of_iterator_collection;
316}
317
318
319
320template <typename Iterator>
323{
324 return &element_of_iterator_collection;
325}
326
327
328
329template <typename Iterator>
332{
333 ++element_of_iterator_collection;
334 return *this;
335}
336
337
338
339template <typename Iterator>
342{
343 const IteratorOverIterators old_value = *this;
344 ++element_of_iterator_collection;
345 return *old_value;
346}
347
348
349
350template <typename Iterator>
351inline bool
353 const IteratorOverIterators &i_o_i) const
354{
355 return element_of_iterator_collection != i_o_i.element_of_iterator_collection;
356}
357
358
359
360template <typename Iterator>
362{
363 return element_of_iterator_collection;
364}
365
366
367
368template <typename Iterator>
370 : it_begin()
371 , it_end()
372{}
373
374
375
376template <typename Iterator>
378 const iterator e)
379 : it_begin(b)
380 , it_end(e)
381{}
382
383
384template <typename Iterator>
387{
388 return it_begin;
389}
390
391
392template <typename Iterator>
395{
396 return it_begin;
397}
398
399
400template <typename Iterator>
403{
404 return it_end;
405}
406
407
408template <typename Iterator>
411{
412 return it_end;
413}
414
415
417
418#endif
typename Iterator::difference_type difference_type
IteratorOverIterators(const BaseIterator &iterator)
BaseIterator element_of_iterator_collection
const BaseIterator & operator*() const
IteratorOverIterators & operator++()
const BaseIterator * operator->() const
std::forward_iterator_tag iterator_category
bool operator!=(const IteratorOverIterators &i_o_i) const
IteratorOverIterators end() const
IteratorOverIterators begin()
const IteratorOverIterators it_begin
const IteratorOverIterators it_end
friend class Tensor
Definition tensor.h:865
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
IteratorRange< BaseIterator > make_iterator_range(const BaseIterator &begin, const std_cxx20::type_identity_t< BaseIterator > &end)
typename type_identity< T >::type type_identity_t
Definition type_traits.h:95