}
std::string
-to_lowercase(const std::string& string)
+to_lowercase(string_view string)
{
- std::string result = string;
- std::transform(result.begin(), result.end(), result.begin(), tolower);
+ std::string result;
+ result.resize(string.length());
+ std::transform(string.begin(), string.end(), result.begin(), tolower);
return result;
}
strip_whitespace(const std::string& string);
// Convert a string to lowercase.
-[[gnu::warn_unused_result]] std::string to_lowercase(const std::string& string);
+[[gnu::warn_unused_result]] std::string
+to_lowercase(nonstd::string_view string);
// Traverse `path` recursively (postorder, i.e. files are visited before their
// parent directory).