]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement const version of begin() and end() function for IteratorRange
authorJean-Paul Pelteret <jppelteret@gmail.com>
Sat, 11 May 2019 16:17:54 +0000 (18:17 +0200)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Sat, 11 May 2019 16:17:54 +0000 (18:17 +0200)
Allows Workstream::run() to be called with constant functions as
arguments.

include/deal.II/base/iterator_range.h

index dd3f0d20d536cc3ca937028e40dcf9e646585e03..41c5f40a6fa00cd946f0fd4c98d436b5a219f8f5 100644 (file)
@@ -161,6 +161,19 @@ public:
   IteratorOverIterators
   begin();
 
+  /**
+   * Return the iterator pointing to the first element of this range.
+   */
+  IteratorOverIterators
+  begin() const;
+
+  /**
+   * Return the iterator pointing to the element past the last element of this
+   * range.
+   */
+  IteratorOverIterators
+  end() const;
+
   /**
    * Return the iterator pointing to the element past the last element of this
    * range.
@@ -379,6 +392,14 @@ IteratorRange<Iterator>::begin()
 }
 
 
+template <typename Iterator>
+inline typename IteratorRange<Iterator>::IteratorOverIterators
+IteratorRange<Iterator>::begin() const
+{
+  return it_begin;
+}
+
+
 template <typename Iterator>
 inline typename IteratorRange<Iterator>::IteratorOverIterators
 IteratorRange<Iterator>::end()
@@ -387,6 +408,14 @@ IteratorRange<Iterator>::end()
 }
 
 
+template <typename Iterator>
+inline typename IteratorRange<Iterator>::IteratorOverIterators
+IteratorRange<Iterator>::end() const
+{
+  return it_end;
+}
+
+
 DEAL_II_NAMESPACE_CLOSE
 
 #endif

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.