From 84570013e3e5c266d43db7c51c16ad0c4769377e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 26 Jul 2016 17:10:13 -0600 Subject: [PATCH] Derive IndexSet iterators from std::iterator with appropriate category. This helps make some algorithms more efficient when called with such iterators. It is apparently also necessary for Visual Studio when calling std::set::insert with a pair of IndexSet iterators. --- include/deal.II/base/index_set.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/deal.II/base/index_set.h b/include/deal.II/base/index_set.h index 6812433b0e..bec25563bd 100644 --- a/include/deal.II/base/index_set.h +++ b/include/deal.II/base/index_set.h @@ -22,6 +22,8 @@ #include #include #include +#include + #ifdef DEAL_II_WITH_TRILINOS # include @@ -496,7 +498,7 @@ public: * Class that represents an iterator pointing to a contiguous interval * $[a,b[$ as returned by IndexSet::begin_interval(). */ - class IntervalIterator + class IntervalIterator : public std::iterator { public: /** @@ -579,14 +581,16 @@ public: * Class that represents an iterator pointing to a single element in the * IndexSet as returned by IndexSet::begin(). */ - class ElementIterator + class ElementIterator : public std::iterator { public: /** * Construct an iterator pointing to the global index @p index in the * interval @p range_idx */ - ElementIterator(const IndexSet *idxset, const size_type range_idx, const size_type index); + ElementIterator(const IndexSet *idxset, + const size_type range_idx, + const size_type index); /** * Construct an iterator pointing to the end of the IndexSet. @@ -1129,7 +1133,7 @@ inline IndexSet::ElementIterator IndexSet::ElementIterator::operator++ (int) { - IndexSet::ElementIterator it = *this; + const IndexSet::ElementIterator it = *this; advance(); return it; } -- 2.39.5