From f34dde32d10413d0540c8cd91bf192267a619697 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 22 Jul 2018 15:36:30 -0400 Subject: [PATCH] string_util: Use emplace_back() in SplitString() instead of push_back() This is equivalent to doing: push_back(std::string("")); which is likely not to cause issues, assuming a decent std::string implementation with small-string optimizations implemented in its design, however it's still a little unnecessary to copy that buffer regardless. Instead, we can use emplace_back() to directly construct the empty string within the std::vector instance, eliminating any possible overhead from the copy. --- src/common/string_util.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index f7ce3d93c..670c857dd 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -230,8 +230,9 @@ void SplitString(const std::string& str, const char delim, std::vector