Reference documentation for deal.II version 9.5.0
\(\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// Copyright (C) 2014 - 2023 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
23
25
26
27// Forward declaration
28#ifndef DOXYGEN
29template <typename Iterator>
31#endif
32
33
125template <typename Iterator>
127{
128public:
133
134
138 using iterator = Iterator;
139
146
155
160 begin();
161
166 begin() const;
167
173 end() const;
174
180 end();
181
182private:
188};
189
190
191
196template <typename Iterator>
198{
199public:
204 using BaseIterator = Iterator;
205
212 explicit IteratorOverIterators(const BaseIterator &iterator);
213
218 const BaseIterator &
219 operator*() const;
220
225 const BaseIterator *
226 operator->() const;
227
233 operator++();
234
241 operator++(int);
242
249 bool
250 operator!=(const IteratorOverIterators &i_o_i) const;
251
265 operator const BaseIterator &() const;
266
272 using iterator_category = std::forward_iterator_tag;
273 using value_type = Iterator;
274 using difference_type = typename Iterator::difference_type;
275 using pointer = Iterator *;
276 using reference = Iterator &;
277
278private:
283};
284
285
286
291template <typename BaseIterator>
295{
296 IteratorRange<BaseIterator> ir(begin, end);
297 return ir;
298}
299
300
301// ------------------- template member functions
302
303
304template <typename Iterator>
306 const BaseIterator &iterator)
307 : element_of_iterator_collection(iterator)
308{}
309
310
311
312template <typename Iterator>
315{
316 return element_of_iterator_collection;
317}
318
319
320
321template <typename Iterator>
324{
325 return &element_of_iterator_collection;
326}
327
328
329
330template <typename Iterator>
333{
334 ++element_of_iterator_collection;
335 return *this;
336}
337
338
339
340template <typename Iterator>
343{
344 const IteratorOverIterators old_value = *this;
345 ++element_of_iterator_collection;
346 return *old_value;
347}
348
349
350
351template <typename Iterator>
352inline bool
354 const IteratorOverIterators &i_o_i) const
355{
356 return element_of_iterator_collection != i_o_i.element_of_iterator_collection;
357}
358
359
360
361template <typename Iterator>
363{
364 return element_of_iterator_collection;
365}
366
367
368
369template <typename Iterator>
371 : it_begin()
372 , it_end()
373{}
374
375
376
377template <typename Iterator>
379 const iterator e)
380 : it_begin(b)
381 , it_end(e)
382{}
383
384
385template <typename Iterator>
388{
389 return it_begin;
390}
391
392
393template <typename Iterator>
396{
397 return it_begin;
398}
399
400
401template <typename Iterator>
404{
405 return it_end;
406}
407
408
409template <typename Iterator>
412{
413 return it_end;
414}
415
416
418
419#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()
::IteratorOverIterators< Iterator > IteratorOverIterators
const IteratorOverIterators it_begin
const IteratorOverIterators it_end
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
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:96