diff --git a/string.hpp b/string.hpp index fc531b12..a1bf4bbb 100644 --- a/string.hpp +++ b/string.hpp @@ -40,7 +40,7 @@ namespace cruft { /// Apply a functor to each character of a string and return the result. template std::string - transform (std::string const &val, FunctionT &&func) + transform (std::string_view val, FunctionT &&func) { std::string res; res.reserve (val.size ()); @@ -56,6 +56,13 @@ namespace cruft { } + inline std::string + to_upper (std::string_view const &val) + { + return transform (val, ::toupper); + } + + /// Convert the provided string to all upper case inline std::string to_upper (std::string &&val)