diff --git a/.travis.yml b/.travis.yml index d9e89e57..17b9ea1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,8 @@ env: # to boost's .tar.gz. - LCOV_ROOT=$HOME/lcov - VALGRIND_ROOT=$HOME/valgrind-install - - BOOST_ROOT=$HOME/boost_1_64_0 - - BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.gz' + - BOOST_ROOT=$HOME/boost_1_58_0 + - BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.gz' addons: apt: diff --git a/CHANGELOG.md b/CHANGELOG.md index ee27b05f..45372099 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Version 68: * Split common tests to a new project * Small speed up in fields comparisons * Adjust buffer size in fast server +* Use string_ref in older Boost versions API Changes: diff --git a/CMakeLists.txt b/CMakeLists.txt index 95d5e34e..34d88bdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ endif() option (Boost_USE_STATIC_LIBS "Use static libraries for boost" ON) set (BOOST_COMPONENTS coroutine context filesystem program_options system thread) -find_package (Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) +find_package (Boost 1.58.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS}) link_directories(${Boost_LIBRARY_DIRS}) diff --git a/include/beast/core/string.hpp b/include/beast/core/string.hpp index 3b96c838..eeb7c59c 100644 --- a/include/beast/core/string.hpp +++ b/include/beast/core/string.hpp @@ -8,11 +8,34 @@ #ifndef BEAST_STRING_HPP #define BEAST_STRING_HPP +#include +#ifndef BEAST_NO_BOOST_STRING_VIEW +# if BOOST_VERSION >= 106400 +# define BEAST_NO_BOOST_STRING_VIEW 0 +# else +# define BEAST_NO_BOOST_STRING_VIEW 1 +# endif +#endif + +#if BEAST_NO_BOOST_STRING_VIEW +#include +#else #include +#endif + #include namespace beast { +#if BEAST_NO_BOOST_STRING_VIEW +/// The type of string view used by the library +using string_view = boost::string_ref; + +/// The type of basic string view used by the library +template +using basic_string_view = + boost::basic_string_ref; +#else /// The type of string view used by the library using string_view = boost::string_view; @@ -20,6 +43,7 @@ using string_view = boost::string_view; template using basic_string_view = boost::basic_string_view; +#endif namespace detail {