Loading...
Searching...
No Matches
iteratorrange.hh
Go to the documentation of this file.
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
#ifndef DUNE_COMMON_ITERATORRANGE_HH
#define DUNE_COMMON_ITERATORRANGE_HH
namespace Dune {
template<typename Iterator, typename Sentinel=Iterator>
class IteratorRange
{
public:
typedef Iterator iterator;
typedef Sentinel sentinel;
typedef Iterator const_iterator;
IteratorRange(const Iterator& begin, const Sentinel& end)
: begin_(begin)
, end_(end)
{}
IteratorRange()
{}
iterator begin() const
{
return begin_;
}
sentinel end() const
{
return end_;
}
private:
Iterator begin_;
Sentinel end_;
};
}
#endif // DUNE_COMMON_ITERATORRANGE_HH
Dune
Dune namespace
Definition alignedallocator.hh:13
Dune::IteratorRange::end
sentinel end() const
Returns an iterator pointing past the end of the range.
Definition iteratorrange.hh:59
Dune::IteratorRange::IteratorRange
IteratorRange(const Iterator &begin, const Sentinel &end)
Constructs an iterator range on [begin,end).
Definition iteratorrange.hh:43
Dune::IteratorRange::iterator
Iterator iterator
The iterator belonging to this range.
Definition iteratorrange.hh:31
Dune::IteratorRange::sentinel
Sentinel sentinel
The iterator belonging to this range.
Definition iteratorrange.hh:34
Dune::IteratorRange::begin
iterator begin() const
Returns an iterator pointing to the begin of the range.
Definition iteratorrange.hh:53
Dune::IteratorRange::const_iterator
Iterator const_iterator
The iterator belonging to this range.
Definition iteratorrange.hh:40
Dune::IteratorRange::IteratorRange
IteratorRange()
Default constructor, relies on iterators being default-constructible.
Definition iteratorrange.hh:49