Add BOOST_BEAST_USE_STD_STRING_VIEW:

fix #1133, fix #1241

When the macro BOOST_BEAST_USE_STD_STRING_VIEW is defined,
Beast will use std::string_view instead of boost::string_view.

The name boost::beast::string_view is a type alias for the
chosen view type.
This commit is contained in:
Domen Vrankar authored and Vinnie Falco committed 2018-10-07 10:38:36 -07:00
1 parent f3212eba48
commit 806979e37b
7 files changed
+36 -14

No files matched your search

+22 -6
View File
@@ -12,19 +12,35 @@
#include <boost/beast/core/detail/config.hpp>
#include <boost/version.hpp>
#if defined(BOOST_BEAST_USE_STD_STRING_VIEW)
#include <string_view>
#else
#include <boost/utility/string_view.hpp>
#endif
#include <algorithm>
namespace boost {
namespace beast {
/// The type of string view used by the library
using string_view = boost::string_view;
#if defined(BOOST_BEAST_USE_STD_STRING_VIEW)
/// The type of string view used by the library
using string_view = std::string_view;
/// The type of basic string view used by the library
template<class CharT, class Traits>
using basic_string_view =
boost::basic_string_view<CharT, Traits>;
/// The type of basic string view used by the library
template<class CharT, class Traits>
using basic_string_view =
std::basic_string_view<CharT, Traits>;
#else
/// The type of string view used by the library
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_view<CharT, Traits>;
#endif
namespace detail {