Skip to content
Snippets Groups Projects
Commit 2c9596f9 authored by Steffen Müthing's avatar Steffen Müthing
Browse files

[IteratorRange][Release] Make IteratorRange default-constructible and copyable

IteratorRanges are convenient for storing ranges of iterators into a
larger container, e.g. for the per-codim GeometryTypes in an
IndexSet. Unfortunately, you can't just create an array of
IteratorRanges right now because they can neither be copied, nor are
they default-constructible.

This patch fixes that problem and also adds a second typedef
const_iterator to make IteratorRange work in contexts where the
iterating code isn't using range-based for and assumes a const object.
parent de4d4a1f
No related branches found
No related tags found
No related merge requests found
......@@ -23,12 +23,22 @@ namespace Dune {
//! The iterator belonging to this range.
typedef Iterator iterator;
//! The iterator belonging to this range.
/**
* This typedef is here mainly for compatibility reasons.
*/
typedef Iterator const_iterator;
//! Constructs an iterator range on [begin,end).
IteratorRange(const Iterator& begin, const Iterator& end)
: _begin(begin)
, _end(end)
{}
//! Default constructor, relies on iterators being default-constructible.
IteratorRange()
{}
//! Returns an iterator pointing to the begin of the range.
iterator begin() const
{
......@@ -43,8 +53,8 @@ namespace Dune {
private:
const Iterator _begin;
const Iterator _end;
Iterator _begin;
Iterator _end;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment