c++17 string_view support

This commit is contained in:
Seth Hamilton 2018-02-27 09:52:27 -05:00
commit 5324abea8c
6 changed files with 13 additions and 14 deletions

3
.gitignore vendored
View file

@ -21,3 +21,6 @@ io_test
parse_test parse_test
crypto_test crypto_test
status_code_test status_code_test
# Visual Studio 2015/2017 cache/options directory
.vs/

View file

@ -1,3 +0,0 @@
{
"CurrentProjectSetting": "x86-Debug"
}

Binary file not shown.

View file

@ -16,16 +16,6 @@ namespace SimpleWeb {
using errc = std::errc; using errc = std::errc;
using system_error = std::system_error; using system_error = std::system_error;
namespace make_error_code = std; namespace make_error_code = std;
#ifdef __has_include
#if __has_include(<string_view>)
#include<string_view>
using string_view = std::string_view;
#define __has_string_view 1
#endif
#endif
#ifndef __has_string_view
using string_view = const std::string &;
#endif
} // namespace SimpleWeb } // namespace SimpleWeb
#else #else
#include <boost/asio.hpp> #include <boost/asio.hpp>
@ -37,10 +27,19 @@ namespace SimpleWeb {
namespace errc = boost::system::errc; namespace errc = boost::system::errc;
using system_error = boost::system::system_error; using system_error = boost::system::system_error;
namespace make_error_code = boost::system::errc; namespace make_error_code = boost::system::errc;
using string_view = boost::string_ref;
} // namespace SimpleWeb } // namespace SimpleWeb
#endif #endif
#if defined(__has_include) && __has_include(<string_view>)
#include <string_view>
namespace SimpleWeb { using string_view = std::string_view; }
#elif !defined(USE_STANDALONE_ASIO)
#include <boost/utility/string_ref.hpp>
namespace SimpleWeb { using string_view = boost::string_ref; }
#else
namespace SimpleWeb { using string_view = const std::string &; }
#endif
namespace SimpleWeb { namespace SimpleWeb {
template <class socket_type> template <class socket_type>
class Client; class Client;