From 84af235bb235bab565409dfef8e2c13f3dc7f505 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 21 Feb 2016 19:39:10 -0600 Subject: [PATCH] Simplify the code that accumulates the weights for cells during partitioning. --- include/deal.II/grid/tria.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index f6b857743e..cd67d8dc6f 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -39,6 +39,7 @@ DEAL_II_ENABLE_EXTRA_DIAGNOSTICS #include #include #include +#include DEAL_II_NAMESPACE_OPEN @@ -1949,18 +1950,7 @@ public: template T operator()(InputIterator first, InputIterator last) const { - // If there are no slots to call, just return the - // default-constructed value - if (first == last) - return T(); - - T sum = *first++; - while (first != last) - { - sum += *first++; - } - - return sum; + return std::accumulate (first, last, T()); } }; -- 2.39.5