From: Wolfgang Bangerth Date: Mon, 22 Feb 2016 01:39:10 +0000 (-0600) Subject: Simplify the code that accumulates the weights for cells during partitioning. X-Git-Tag: v8.5.0-rc1~1300^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84af235bb235bab565409dfef8e2c13f3dc7f505;p=dealii.git Simplify the code that accumulates the weights for cells during partitioning. --- 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()); } };