blob: c283b34abe083be2038ff8b4aae19e81809875a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
From 405bdec807a7b530173ebf018843c4552dfa20c9 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sat, 6 Jun 2020 11:33:55 -0700
Subject: [PATCH] use std::string_view when available
There's a standard C++ macro to check for its existence.
libstdc++ from GCC makes it available under C++17 and up. libcxx from
LLVM makes it available everywhere.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
ext/lmdb-safe/lmdb-safe.hh | 7 +++----
pdns/dnsdistdist/views.hh | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/ext/lmdb-safe/lmdb-safe.hh b/ext/lmdb-safe/lmdb-safe.hh
index 056a6cd823..16d150fa7d 100644
--- a/ext/lmdb-safe/lmdb-safe.hh
+++ b/ext/lmdb-safe/lmdb-safe.hh
@@ -10,8 +10,9 @@
#include <string.h>
#include <mutex>
-// apple compiler somehow has string_view even in c++11!
-#if __cplusplus < 201703L && !defined(__APPLE__)
+#ifdef __cpp_lib_string_view
+using std::string_view;
+#else
#include <boost/version.hpp>
#if BOOST_VERSION >= 106100
#include <boost/utility/string_view.hpp>
@@ -20,8 +21,6 @@ using boost::string_view;
#include <boost/utility/string_ref.hpp>
using string_view = boost::string_ref;
#endif
-#else // C++17
-using std::string_view;
#endif
|