From: Wolfgang Bangerth Date: Thu, 13 Jan 2022 17:58:18 +0000 (-0700) Subject: Simplify code using std::adjacent_find. X-Git-Tag: v9.4.0-rc1~618^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e35f063df6f67da38ab7db22a8b933890dd446bc;p=dealii.git Simplify code using std::adjacent_find. --- diff --git a/source/base/mpi.cc b/source/base/mpi.cc index 53ac3bbb43..6d04a9b395 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -419,12 +419,9 @@ namespace Utilities { std::vector my_destinations = destinations; std::sort(my_destinations.begin(), my_destinations.end()); - - for (unsigned int i = 0; i < my_destinations.size() - 1; ++i) - if (my_destinations[i] == my_destinations[i + 1]) - return false; - - return true; + return (std::adjacent_find(my_destinations.begin(), + my_destinations.end()) == + my_destinations.end()); } }();