Dune Core Modules (unstable)

iteratorrange.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5#ifndef DUNE_COMMON_ITERATORRANGE_HH
6#define DUNE_COMMON_ITERATORRANGE_HH
7
8namespace Dune {
9
11
20 template<typename Iterator>
22 {
23
24 public:
25
27 typedef Iterator iterator;
28
30
33 typedef Iterator const_iterator;
34
36 IteratorRange(const Iterator& begin, const Iterator& end)
37 : _begin(begin)
38 , _end(end)
39 {}
40
43 {}
44
47 {
48 return _begin;
49 }
50
52 iterator end() const
53 {
54 return _end;
55 }
56
57 private:
58
59 Iterator _begin;
60 Iterator _end;
61
62 };
63
64}
65
66#endif // DUNE_COMMON_ITERATORRANGE_HH
Simple range between a begin and an end iterator.
Definition: iteratorrange.hh:22
iterator begin() const
Returns an iterator pointing to the begin of the range.
Definition: iteratorrange.hh:46
Iterator const_iterator
The iterator belonging to this range.
Definition: iteratorrange.hh:33
iterator end() const
Returns an iterator pointing past the end of the range.
Definition: iteratorrange.hh:52
IteratorRange()
Default constructor, relies on iterators being default-constructible.
Definition: iteratorrange.hh:42
Iterator iterator
The iterator belonging to this range.
Definition: iteratorrange.hh:27
IteratorRange(const Iterator &begin, const Iterator &end)
Constructs an iterator range on [begin,end).
Definition: iteratorrange.hh:36
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)