From 7c4fca0ae1ce3eca43ac28df685671b4225da7d9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 15 Nov 2022 00:36:24 +0100 Subject: [PATCH] util/SpanCast: add ToStringView() template --- src/util/SpanCast.hxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/util/SpanCast.hxx b/src/util/SpanCast.hxx index 11f5b60ce..58e25c85a 100644 --- a/src/util/SpanCast.hxx +++ b/src/util/SpanCast.hxx @@ -96,3 +96,17 @@ ToStringView(std::span s) noexcept { return ToStringView(FromBytesStrict(s)); } + +template +constexpr std::basic_string_view +ToStringView(std::span s) noexcept +{ + return {s.data(), s.size()}; +} + +template +constexpr std::basic_string_view +ToStringView(std::span s) noexcept +{ + return {s.data(), s.size()}; +}