Skip to content

Commit 05b42a6

Browse files
authored
Use string ref when iterating vector<String> (#11)
1 parent 56488a8 commit 05b42a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/improv.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ std::vector<uint8_t> build_rpc_response(Command command, const std::vector<std::
9898
std::vector<uint8_t> out;
9999
uint32_t length = 0;
100100
out.push_back(command);
101-
for (auto str : datum) {
101+
for (const auto &str : datum) {
102102
uint8_t len = str.length();
103103
length += len + 1;
104104
out.push_back(len);
@@ -122,7 +122,7 @@ std::vector<uint8_t> build_rpc_response(Command command, const std::vector<Strin
122122
std::vector<uint8_t> out;
123123
uint32_t length = 0;
124124
out.push_back(command);
125-
for (auto str : datum) {
125+
for (const auto &str : datum) {
126126
uint8_t len = str.length();
127127
length += len;
128128
out.push_back(len);

0 commit comments

Comments
 (0)