From: Wolfgang Bangerth Date: Thu, 2 Jun 2022 13:54:53 +0000 (-0600) Subject: Pre-allocate the size of an array. X-Git-Tag: v9.5.0-rc1~1036^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13895%2Fhead;p=dealii.git Pre-allocate the size of an array. --- diff --git a/source/base/mpi_compute_index_owner_internal.cc b/source/base/mpi_compute_index_owner_internal.cc index 8f1dd43b96..c96e46a9f0 100644 --- a/source/base/mpi_compute_index_owner_internal.cc +++ b/source/base/mpi_compute_index_owner_internal.cc @@ -354,8 +354,9 @@ namespace Utilities /* targets = */ [&buffers]() { std::vector targets; + targets.reserve(buffers.size()); for (const auto &rank_pair : buffers) - targets.push_back(rank_pair.first); + targets.emplace_back(rank_pair.first); return targets; }(),