From: Remi Gacogne Date: Fri, 18 Sep 2020 07:42:04 +0000 (+0200) Subject: Fix our string_view usage on older distributions X-Git-Tag: auth-4.4.0-alpha1~32^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14096b1c4d44ad9e2b1502076f8003dea080549d;p=thirdparty%2Fpdns.git Fix our string_view usage on older distributions - 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. --- diff --git a/pdns/views.hh b/pdns/views.hh index 7e56c1590d..21fa8bb2ce 100644 --- a/pdns/views.hh +++ b/pdns/views.hh @@ -26,11 +26,15 @@ using std::string_view; #else #include -#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 using boost::string_view; -#else +#elif BOOST_VERSION >= 105300 #include using string_view = boost::string_ref; +#else +using string_view = std::string; #endif #endif