You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.2 KiB

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