From 37838a49ec825318765e0a4e2300e83dc7be7a8a Mon Sep 17 00:00:00 2001 From: raven02 Date: Thu, 18 Dec 2014 00:10:20 +0800 Subject: [PATCH] Revert fmt::merge --- Utilities/StrFmt.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Utilities/StrFmt.cpp b/Utilities/StrFmt.cpp index 8fbdeda31c..ae150c4f79 100644 --- a/Utilities/StrFmt.cpp +++ b/Utilities/StrFmt.cpp @@ -137,17 +137,14 @@ std::vector fmt::split(const std::string& source, std::initializer_ std::string fmt::merge(std::vector source, const std::string& separator) { - if (!source.size()) - return ""; - std::string result; - for (int i = 0; i < source.size() - 1; ++i) + for (auto &s : source) { - result += source[i] + separator; + result += s + separator; } - return result + source[source.size() - 1]; + return result; } std::string fmt::merge(std::initializer_list> sources, const std::string& separator) @@ -167,4 +164,4 @@ std::string fmt::tolower(std::string source) std::transform(source.begin(), source.end(), source.begin(), ::tolower); return source; -} \ No newline at end of file +}