From 44824a4166895c0dc7863626dfe34eee3b8390af Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sat, 24 Jun 2017 11:33:04 -0700 Subject: [PATCH] Use boost::string_view --- .travis.yml | 4 ++-- CHANGELOG.md | 1 + appveyor.yml | 1 + include/beast/core/detail/static_string.hpp | 6 +++--- include/beast/core/static_string.hpp | 2 +- include/beast/core/string.hpp | 6 +++--- scripts/install-dependencies.sh | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 17b9ea1c..d9e89e57 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_58_0 - - BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.gz' + - 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' addons: apt: diff --git a/CHANGELOG.md b/CHANGELOG.md index 98804eb4..5863b5cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Version 67: * Fix doc example link * Add http-server-small example * Merge stream_base to stream and tidy +* Use boost::string_view -------------------------------------------------------------------------------- diff --git a/appveyor.yml b/appveyor.yml index 20125e5e..79cca1fb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,6 +19,7 @@ install: - cd .. - git clone https://github.com/boostorg/boost.git boost - cd boost + - git checkout boost-1.64.0 - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\beast\ - git submodule update --init tools/build - git submodule update --init libs/config diff --git a/include/beast/core/detail/static_string.hpp b/include/beast/core/detail/static_string.hpp index 03468e01..7ded7fff 100644 --- a/include/beast/core/detail/static_string.hpp +++ b/include/beast/core/detail/static_string.hpp @@ -41,7 +41,7 @@ template inline int lexicographical_compare( - boost::basic_string_ref s1, + basic_string_view s1, CharT const* s2, std::size_t n2) { return lexicographical_compare( @@ -52,8 +52,8 @@ template inline int lexicographical_compare( - boost::basic_string_ref s1, - boost::basic_string_ref s2) + basic_string_view s1, + basic_string_view s2) { return lexicographical_compare( s1.data(), s1.size(), s2.data(), s2.size()); diff --git a/include/beast/core/static_string.hpp b/include/beast/core/static_string.hpp index fd324533..0d0dc8f2 100644 --- a/include/beast/core/static_string.hpp +++ b/include/beast/core/static_string.hpp @@ -345,7 +345,7 @@ public: /// Convert a static string to a `string_view_type` operator string_view_type() const { - return boost::basic_string_ref< + return basic_string_view< CharT, Traits>{data(), size()}; } diff --git a/include/beast/core/string.hpp b/include/beast/core/string.hpp index 862b24d0..3b96c838 100644 --- a/include/beast/core/string.hpp +++ b/include/beast/core/string.hpp @@ -8,18 +8,18 @@ #ifndef BEAST_STRING_HPP #define BEAST_STRING_HPP -#include +#include #include namespace beast { /// The type of string view used by the library -using string_view = boost::string_ref; +using string_view = boost::string_view; /// The type of basic string view used by the library template using basic_string_view = - boost::basic_string_ref; + boost::basic_string_view; namespace detail { diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index df2aa312..7e3421cd 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -34,7 +34,7 @@ if [[ ! -x cmake/bin/cmake && -d cmake ]]; then rm -fr cmake fi if [[ ! -d cmake && ${BUILD_SYSTEM:-} == cmake ]]; then - CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz" + CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.8.0-Linux-x86_64.tar.gz" mkdir cmake && wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake fi