Use boost::string_view

This commit is contained in:
Vinnie Falco
2017-06-24 11:33:04 -07:00
parent cc1c02e236
commit 44824a4166
7 changed files with 12 additions and 10 deletions

View File

@@ -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:

View File

@@ -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
--------------------------------------------------------------------------------

View File

@@ -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

View File

@@ -41,7 +41,7 @@ template<class CharT, class Traits>
inline
int
lexicographical_compare(
boost::basic_string_ref<CharT, Traits> s1,
basic_string_view<CharT, Traits> s1,
CharT const* s2, std::size_t n2)
{
return lexicographical_compare<CharT, Traits>(
@@ -52,8 +52,8 @@ template<class CharT, class Traits>
inline
int
lexicographical_compare(
boost::basic_string_ref<CharT, Traits> s1,
boost::basic_string_ref<CharT, Traits> s2)
basic_string_view<CharT, Traits> s1,
basic_string_view<CharT, Traits> s2)
{
return lexicographical_compare<CharT, Traits>(
s1.data(), s1.size(), s2.data(), s2.size());

View File

@@ -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()};
}

View File

@@ -8,18 +8,18 @@
#ifndef BEAST_STRING_HPP
#define BEAST_STRING_HPP
#include <boost/utility/string_ref.hpp>
#include <boost/utility/string_view.hpp>
#include <algorithm>
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<class CharT, class Traits>
using basic_string_view =
boost::basic_string_ref<CharT, Traits>;
boost::basic_string_view<CharT, Traits>;
namespace detail {

View File

@@ -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