From 05b42a60ce620d38f3035a5599d9aa5c4b21bd1a Mon Sep 17 00:00:00 2001 From: John Boiles Date: Thu, 7 Apr 2022 12:45:09 -0700 Subject: [PATCH] Use string ref when iterating `vector` (#11) --- src/improv.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/improv.cpp b/src/improv.cpp index 63ebc9d..bce9747 100644 --- a/src/improv.cpp +++ b/src/improv.cpp @@ -98,7 +98,7 @@ std::vector build_rpc_response(Command command, const std::vector out; uint32_t length = 0; out.push_back(command); - for (auto str : datum) { + for (const auto &str : datum) { uint8_t len = str.length(); length += len + 1; out.push_back(len); @@ -122,7 +122,7 @@ std::vector build_rpc_response(Command command, const std::vector out; uint32_t length = 0; out.push_back(command); - for (auto str : datum) { + for (const auto &str : datum) { uint8_t len = str.length(); length += len; out.push_back(len);