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. # to boost's .tar.gz.
- LCOV_ROOT=$HOME/lcov - LCOV_ROOT=$HOME/lcov
- VALGRIND_ROOT=$HOME/valgrind-install - VALGRIND_ROOT=$HOME/valgrind-install
- BOOST_ROOT=$HOME/boost_1_58_0 - BOOST_ROOT=$HOME/boost_1_64_0
- BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.gz' - BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.gz'
addons: addons:
apt: apt:

View File

@@ -3,6 +3,7 @@ Version 67:
* Fix doc example link * Fix doc example link
* Add http-server-small example * Add http-server-small example
* Merge stream_base to stream and tidy * Merge stream_base to stream and tidy
* Use boost::string_view
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -19,6 +19,7 @@ install:
- cd .. - cd ..
- git clone https://github.com/boostorg/boost.git boost - git clone https://github.com/boostorg/boost.git boost
- cd boost - cd boost
- git checkout boost-1.64.0
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\beast\ - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\beast\
- git submodule update --init tools/build - git submodule update --init tools/build
- git submodule update --init libs/config - git submodule update --init libs/config

View File

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

View File

@@ -345,7 +345,7 @@ public:
/// Convert a static string to a `string_view_type` /// Convert a static string to a `string_view_type`
operator string_view_type() const operator string_view_type() const
{ {
return boost::basic_string_ref< return basic_string_view<
CharT, Traits>{data(), size()}; CharT, Traits>{data(), size()};
} }

View File

@@ -8,18 +8,18 @@
#ifndef BEAST_STRING_HPP #ifndef BEAST_STRING_HPP
#define BEAST_STRING_HPP #define BEAST_STRING_HPP
#include <boost/utility/string_ref.hpp> #include <boost/utility/string_view.hpp>
#include <algorithm> #include <algorithm>
namespace beast { namespace beast {
/// The type of string view used by the library /// 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 /// The type of basic string view used by the library
template<class CharT, class Traits> template<class CharT, class Traits>
using basic_string_view = using basic_string_view =
boost::basic_string_ref<CharT, Traits>; boost::basic_string_view<CharT, Traits>;
namespace detail { namespace detail {

View File

@@ -34,7 +34,7 @@ if [[ ! -x cmake/bin/cmake && -d cmake ]]; then
rm -fr cmake rm -fr cmake
fi fi
if [[ ! -d cmake && ${BUILD_SYSTEM:-} == cmake ]]; then 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 mkdir cmake && wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
fi fi