]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Return iterator by const reference 6844/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 25 Jun 2018 23:13:11 +0000 (01:13 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Tue, 26 Jun 2018 00:33:57 +0000 (02:33 +0200)
include/deal.II/base/iterator_range.h

index eaba74d7197fe59a30d3e168344f44463068c66f..eb45a2f8eeded4b11cd308f8cb349d51fa6347ff 100644 (file)
@@ -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<Iterator>::IteratorOverIterators::IteratorOverIterators(
 
 
 template <typename Iterator>
-inline typename IteratorRange<Iterator>::IteratorOverIterators::BaseIterator
+inline const typename IteratorRange<
+  Iterator>::IteratorOverIterators::BaseIterator &
   IteratorRange<Iterator>::IteratorOverIterators::operator*() const
 {
   return element_of_iterator_collection;
@@ -316,7 +317,7 @@ template <typename Iterator>
 inline typename IteratorRange<Iterator>::IteratorOverIterators
 IteratorRange<Iterator>::begin()
 {
-  return IteratorOverIterators(it_begin);
+  return it_begin;
 }
 
 
@@ -324,7 +325,7 @@ template <typename Iterator>
 inline typename IteratorRange<Iterator>::IteratorOverIterators
 IteratorRange<Iterator>::end()
 {
-  return IteratorOverIterators(it_end);
+  return it_end;
 }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.