trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [trafficserver] 01/03: TextView: Add constexpr literal constructor for std::string_view.
Date Tue, 03 Jul 2018 12:56:33 GMT
This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 0225210345ec575c4ddbe37ed011e16f6e61738e
Author: Alan M. Carroll <amc@apache.org>
AuthorDate: Mon Jul 2 20:34:08 2018 -0500

    TextView: Add constexpr literal constructor for std::string_view.
---
 lib/ts/TextView.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/ts/TextView.h b/lib/ts/TextView.h
index a1a688f..d4494cd 100644
--- a/lib/ts/TextView.h
+++ b/lib/ts/TextView.h
@@ -1018,3 +1018,13 @@ namespace std
 {
 ostream &operator<<(ostream &os, const ts::TextView &b);
 }
+
+// @c constexpr literal constructor for @c std::string_view
+// For unknown reasons, this enables creating @c constexpr constructs using @c std::string_view
while the standard
+// one (""sv) does not.
+// I couldn't think of any better place to put this, so it's here. At least @c TextView is
strongly related
+// to @c std::string_view.
+constexpr std::string_view operator"" _sv(const char *s, size_t n)
+{
+  return {s, n};
+}


Mime
View raw message