From 7d916e09d3c03127259e7bad7b99bbf4c090b511 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 1 Feb 2020 17:02:40 +0100 Subject: StringView: Implement operator ""_sv This allows us to define constexpr string view literals. --- apt-pkg/contrib/string_view.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/string_view.h b/apt-pkg/contrib/string_view.h index f4f0c645f..05aad3327 100644 --- a/apt-pkg/contrib/string_view.h +++ b/apt-pkg/contrib/string_view.h @@ -123,7 +123,10 @@ static inline int StringViewCompareFast(StringView a, StringView b) { return memcmp(a.data(), b.data(), a.size()); } - +static constexpr inline APT::StringView operator""_sv(const char *data, size_t size) +{ + return APT::StringView(data, size); +} } inline bool operator ==(const char *other, APT::StringView that); -- cgit v1.2.3