From ff510157d8f26004a1730650202bcae644921cca Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Wed, 25 Jul 2018 08:03:43 +0800 Subject: common/string_utils: replace boost::transform with std counterpart Note: according to cppreference it is necessary to convert char to unsigned char when using std::tolower and std::toupper, otherwise the behaviour would be undefined. --- src/common/string_util.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/common') diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 1f0456aee..0ca663032 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -2,12 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include #include #include #include #include -#include #include "common/common_paths.h" #include "common/logging/log.h" #include "common/string_util.h" @@ -24,13 +24,15 @@ namespace Common { /// Make a string lowercase std::string ToLower(std::string str) { - boost::transform(str, str.begin(), ::tolower); + std::transform(str.begin(), str.end(), str.begin(), + [](unsigned char c) { return std::tolower(c); }); return str; } /// Make a string uppercase std::string ToUpper(std::string str) { - boost::transform(str, str.begin(), ::toupper); + std::transform(str.begin(), str.end(), str.begin(), + [](unsigned char c) { return std::toupper(c); }); return str; } -- cgit v1.2.3