diff --git a/src/libutil/util.hh b/src/libutil/util.hh index de0eb10e9..ea90f60e7 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -706,4 +706,19 @@ template overloaded(Ts...) -> overloaded; std::string showBytes(uint64_t bytes); +/* Provide an addition operator between strings and string_views + inexplicably omitted from the standard library. */ +inline std::string operator + (const std::string & s1, std::string_view s2) +{ + auto s = s1; + s.append(s2); + return s; +} + +inline std::string operator + (std::string && s, std::string_view s2) +{ + s.append(s2); + return s; +} + }