Skip to content

Commit 85b594e

Browse files
authored
fix(c++): use std::move to reduce copy (#859)
1 parent 1555815 commit 85b594e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

cpp/src/graphar/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ inline std::vector<std::string> SplitString(const std::string& str,
286286
std::string token;
287287
std::istringstream tokenStream(str);
288288
while (std::getline(tokenStream, token, delimiter)) {
289-
tokens.push_back(token);
289+
tokens.push_back(std::move(token));
290290
}
291291
return tokens;
292292
}

cpp/src/graphar/version_parser.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <iostream>
2222
#include <regex> // NOLINT
2323
#include <string>
24+
#include <utility>
2425

2526
#include "graphar/version_parser.h"
2627

@@ -92,7 +93,7 @@ std::vector<std::string> parseUserDefineTypesImpl(
9293
std::string type = types_str.substr(pos, next_pos - pos);
9394
trim(type);
9495
if (!type.empty()) {
95-
user_define_types.push_back(type);
96+
user_define_types.push_back(std::move(type));
9697
}
9798
if (next_pos != std::string::npos) {
9899
pos = next_pos + 1;

0 commit comments

Comments
 (0)