1
0
Fork 0

StringUtils: Dropped an unneeded copy in lower-/upper-casing. (#3512)

This commit is contained in:
Mattes D 2017-02-13 19:56:34 +01:00 committed by GitHub
parent 7b8380c6df
commit 72e401313b
1 changed files with 6 additions and 4 deletions

View File

@ -304,8 +304,9 @@ AString & InPlaceUppercase(AString & s)
AString StrToLower(const AString & s)
{
AString res(s);
std::transform(res.begin(), res.end(), res.begin(), ::tolower);
AString res;
res.resize(s.size());
std::transform(s.begin(), s.end(), res.begin(), ::tolower);
return res;
}
@ -315,8 +316,9 @@ AString StrToLower(const AString & s)
AString StrToUpper(const AString & s)
{
AString res(s);
std::transform(res.begin(), res.end(), res.begin(), ::toupper);
AString res;
res.resize(s.size());
std::transform(s.begin(), s.end(), res.begin(), ::toupper);
return res;
}