string: add string_view overload to to_upper
This commit is contained in:
parent
7b5a0b7ad0
commit
757253ee4e
@ -40,7 +40,7 @@ namespace cruft {
|
||||
/// Apply a functor to each character of a string and return the result.
|
||||
template <typename FunctionT>
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user