]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make code readable by using 'auto'. 13151/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 29 Dec 2021 17:26:02 +0000 (10:26 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 29 Dec 2021 19:27:51 +0000 (12:27 -0700)
include/deal.II/base/parallel.h

index a45bfd8acea6612da5e4f049c0dbfc1a0c0fb3eb..4cf5f035d1c8b4be52bb957668a7acd53836462f 100644 (file)
@@ -153,8 +153,9 @@ namespace parallel
     internal::parallel_for(
       SyncIterators(x_begin),
       SyncIterators(x_end),
-      [predicate](const std::tuple<InputIterator, OutputIterator> &p) {
-        *std::get<1>(p) = predicate(*std::get<0>(p));
+      [predicate](const auto &range) {
+        for (const auto &p : range)
+          *std::get<1>(p) = predicate(*std::get<0>(p));
       },
       grainsize);
 #endif
@@ -213,9 +214,9 @@ namespace parallel
     internal::parallel_for(
       SyncIterators(x_begin),
       SyncIterators(x_end),
-      [predicate](
-        const std::tuple<InputIterator1, InputIterator2, OutputIterator> &p) {
-        *std::get<2>(p) = predicate(*std::get<0>(p), *std::get<1>(p));
+      [predicate](const auto &range) {
+        for (const auto &p : range)
+          *std::get<2>(p) = predicate(*std::get<0>(p), *std::get<1>(p));
       },
       grainsize);
 #endif
@@ -279,12 +280,10 @@ namespace parallel
     internal::parallel_for(
       SyncIterators(x_begin),
       SyncIterators(x_end),
-      [predicate](
-        const std::
-          tuple<InputIterator1, InputIterator2, InputIterator3, OutputIterator>
-            &p) {
-        *std::get<3>(p) =
-          predicate(*std::get<0>(p), *std::get<1>(p), *std::get<2>(p));
+      [predicate](const auto &range) {
+        for (const auto &p : range)
+          *std::get<3>(p) =
+            predicate(*std::get<0>(p), *std::get<1>(p), *std::get<2>(p));
       },
       grainsize);
 #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.