1
0
Derivar 0

utils: trim(): Take string_view

Este cometimento está contido em:
Albert S. 2021-10-10 12:01:16 +02:00
ascendente 86ac86b83f
cometimento 9593429f95
2 ficheiros modificados com 2 adições e 3 eliminações

Ver ficheiro

@ -182,10 +182,9 @@ std::string utils::toISODate(time_t t)
return std::string{result};
}
std::string utils::trim(const std::string &str)
std::string utils::trim(std::string_view view)
{
std::string_view chars = " \t\n\r";
std::string_view view = str;
auto n = view.find_first_not_of(chars);
if(n != std::string_view::npos)
{

Ver ficheiro

@ -93,7 +93,7 @@ template <class T> inline std::string toString(const T &v)
return std::string(v.begin(), v.end());
}
std::string trim(const std::string &str);
std::string trim(std::string_view view);
} // namespace utils
#endif