From 5900bdf0f6adf9b01b7e6d3844d4ef1e4b3009c7 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Tue, 5 Mar 2024 09:44:42 +0800 Subject: [PATCH] fix remove std::transform --- src/strings/utils.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/strings/utils.cc b/src/strings/utils.cc index 6a419a7..05a3651 100644 --- a/src/strings/utils.cc +++ b/src/strings/utils.cc @@ -19,19 +19,17 @@ ToUpper(char c) std::string ToLower(const std::string &str) { - std::string result; - std::transform(str.begin(), str.end(), std::back_inserter(result), - ::tolower); - return result; + std::stringstream ss; + for (auto &ch : str) { ss << ToLower(ch); } + return ss.str(); } std::string ToUpper(const std::string &str) { - std::string result; - std::transform(str.begin(), str.end(), std::back_inserter(result), - ::toupper); - return result; + std::stringstream ss; + for (auto &ch : str) { ss << ToUpper(ch); } + return ss.str(); } std::string