From: Daniel Arndt Date: Mon, 25 Jun 2018 23:13:11 +0000 (+0200) Subject: Return iterator by const reference X-Git-Tag: v9.1.0-rc1~980^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F6844%2Fhead;p=dealii.git Return iterator by const reference --- diff --git a/include/deal.II/base/iterator_range.h b/include/deal.II/base/iterator_range.h index eaba74d719..eb45a2f8ee 100644 --- a/include/deal.II/base/iterator_range.h +++ b/include/deal.II/base/iterator_range.h @@ -142,7 +142,7 @@ public: * Dereferencing operator. * @return The iterator within the collection currently pointed to. */ - BaseIterator operator*() const; + const BaseIterator &operator*() const; /** * Dereferencing operator. @@ -231,8 +231,8 @@ private: /** * Iterators characterizing the begin and end of the range. */ - const iterator it_begin; - const iterator it_end; + const IteratorOverIterators it_begin; + const IteratorOverIterators it_end; }; @@ -248,7 +248,8 @@ inline IteratorRange::IteratorOverIterators::IteratorOverIterators( template -inline typename IteratorRange::IteratorOverIterators::BaseIterator +inline const typename IteratorRange< + Iterator>::IteratorOverIterators::BaseIterator & IteratorRange::IteratorOverIterators::operator*() const { return element_of_iterator_collection; @@ -316,7 +317,7 @@ template inline typename IteratorRange::IteratorOverIterators IteratorRange::begin() { - return IteratorOverIterators(it_begin); + return it_begin; } @@ -324,7 +325,7 @@ template inline typename IteratorRange::IteratorOverIterators IteratorRange::end() { - return IteratorOverIterators(it_end); + return it_end; }