Skip to content

Commit

Permalink
Pre-allocate the size of an array.
Browse files Browse the repository at this point in the history
  • Loading branch information
bangerth committed Jun 2, 2022
1 parent 98a42a7 commit c0823a5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/base/mpi_compute_index_owner_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,9 @@ namespace Utilities
/* targets = */
[&buffers]() {
std::vector<unsigned int> 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;
}(),
Expand Down

0 comments on commit c0823a5

Please sign in to comment.