diff --git a/src/util/SpanCast.hxx b/src/util/SpanCast.hxx index 0ca95bc40..3aec5dfa4 100644 --- a/src/util/SpanCast.hxx +++ b/src/util/SpanCast.hxx @@ -85,3 +85,15 @@ AsBytes(std::string_view sv) noexcept { return std::as_bytes(ToSpan(sv)); } + +constexpr std::string_view +ToStringView(std::span s) noexcept +{ + return {s.data(), s.size()}; +} + +constexpr std::string_view +ToStringView(std::span s) noexcept +{ + return ToStringView(FromBytesStrict(s)); +}