From: Wolfgang Bangerth Date: Tue, 26 Jul 2016 23:10:13 +0000 (-0600) Subject: Derive IndexSet iterators from std::iterator with appropriate category. X-Git-Tag: v8.5.0-rc1~839^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84570013e3e5c266d43db7c51c16ad0c4769377e;p=dealii.git 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. --- 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; }