summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-02-01 17:02:40 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-02-03 12:54:42 +0100
commit7d916e09d3c03127259e7bad7b99bbf4c090b511 (patch)
tree8554162706100a3c4f97b0de6f4eb0a881acb474 /apt-pkg/contrib
parentefc52f1fc9acb6ec815f695506bc8d5045c76834 (diff)
StringView: Implement operator ""_sv
This allows us to define constexpr string view literals.
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/string_view.h5
1 files changed, 4 insertions, 1 deletions
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);