From 026e9c4e3829408e862f4873b17c08e08772e458 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 17 Jul 2024 22:06:45 -0500 Subject: [PATCH] Use emplace_back() instead of push_back() to avoid temporary object --- src/stream.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stream.cpp b/src/stream.cpp index eebeebae8e7..0f6b946347f 100644 --- a/src/stream.cpp +++ b/src/stream.cpp @@ -668,7 +668,7 @@ namespace stream { shards_p[x] = (uint8_t *) next; next += blocksize; } - payload_buffers.push_back({ std::begin(payload), aligned_data_shards * blocksize }); + payload_buffers.emplace_back(std::begin(payload), aligned_data_shards * blocksize); // If the last data shard needs to be zero-padded, we must use the shards buffer if (pad) { @@ -686,7 +686,7 @@ namespace stream { } // Add a payload buffer describing the shard buffer - payload_buffers.push_back(platf::buffer_descriptor_t { std::begin(shards), shards.size() }); + payload_buffers.emplace_back(std::begin(shards), shards.size()); if (fecpercentage != 0) { // Point into our allocated buffer for the parity shards