]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix our string_view usage on older distributions
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 18 Sep 2020 07:42:04 +0000 (09:42 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 18 Sep 2020 07:42:04 +0000 (09:42 +0200)
- boost::string_ref requires Boost >= 1.53.0, which we don't have
  in EL6, fall back to a plain std::string (alloc + copy) there ;
- boost::string_view::at() is broken for modern compilers before
  1.64.0, so let's use boost::string_ref instead in that case.

pdns/views.hh

index 7e56c1590daa566f48f5f6f398417f6cfd060188..21fa8bb2ce8450431d9ef16765111d4c9e434df9 100644 (file)
 using std::string_view;
 #else
 #include <boost/version.hpp>
-#if BOOST_VERSION >= 106100
+#if BOOST_VERSION >= 106400
+// string_view already exists in 1.61.0 but string_view::at() is not usable with modern compilers, see:
+// https://github.com/boostorg/utility/pull/26
 #include <boost/utility/string_view.hpp>
 using boost::string_view;
-#else
+#elif BOOST_VERSION >= 105300
 #include <boost/utility/string_ref.hpp>
 using string_view = boost::string_ref;
+#else
+using string_view = std::string;
 #endif
 #endif