dune-common 2.11
Loading...
Searching...
No Matches
iteratorrange.hh
Go to the documentation of this file.
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
24 template<typename Iterator, typename Sentinel=Iterator>
26 {
27
28 public:
29
31 typedef Iterator iterator;
32
34 typedef Sentinel sentinel;
35
37
40 typedef Iterator const_iterator;
41
43 IteratorRange(const Iterator& begin, const Sentinel& end)
44 : begin_(begin)
45 , end_(end)
46 {}
47
51
54 {
55 return begin_;
56 }
57
59 sentinel end() const
60 {
61 return end_;
62 }
63
64 private:
65
66 Iterator begin_;
67 Sentinel end_;
68
69 };
70
71}
72
73#endif // DUNE_COMMON_ITERATORRANGE_HH
Dune namespace
Definition alignedallocator.hh:13
sentinel end() const
Returns an iterator pointing past the end of the range.
Definition iteratorrange.hh:59
IteratorRange(const Iterator &begin, const Sentinel &end)
Constructs an iterator range on [begin,end).
Definition iteratorrange.hh:43
Iterator iterator
The iterator belonging to this range.
Definition iteratorrange.hh:31
Sentinel sentinel
The iterator belonging to this range.
Definition iteratorrange.hh:34
iterator begin() const
Returns an iterator pointing to the begin of the range.
Definition iteratorrange.hh:53
Iterator const_iterator
The iterator belonging to this range.
Definition iteratorrange.hh:40
IteratorRange()
Default constructor, relies on iterators being default-constructible.
Definition iteratorrange.hh:49