Skip to content

Commit

Permalink
Use string ref when iterating vector<String> (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnboiles authored Apr 7, 2022
1 parent 56488a8 commit 05b42a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/improv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ std::vector<uint8_t> build_rpc_response(Command command, const std::vector<std::
std::vector<uint8_t> 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);
Expand All @@ -122,7 +122,7 @@ std::vector<uint8_t> build_rpc_response(Command command, const std::vector<Strin
std::vector<uint8_t> 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);
Expand Down

0 comments on commit 05b42a6

Please sign in to comment.