From c0823a56eed0b50d8cd60575358b3bcaf40950ab Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 2 Jun 2022 07:54:53 -0600 Subject: [PATCH] Pre-allocate the size of an array. --- source/base/mpi_compute_index_owner_internal.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; }(), -- 2.39.5