mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 14:24:31 +02:00
Workaround for msvc-14.0
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
#include <boost/core/exchange.hpp>
|
||||
#include <boost/type_traits/make_void.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <type_traits>
|
||||
@@ -29,19 +28,24 @@ namespace detail {
|
||||
|
||||
class decorator
|
||||
{
|
||||
friend class decorator_test;
|
||||
|
||||
struct incomplete;
|
||||
|
||||
struct exemplar
|
||||
{
|
||||
void(incomplete::*mf)();
|
||||
std::shared_ptr<incomplete> sp;
|
||||
void* param;
|
||||
};
|
||||
|
||||
static std::size_t constexpr Bytes =
|
||||
beast::detail::max_sizeof<
|
||||
void*,
|
||||
void const*,
|
||||
void(*)(),
|
||||
void(incomplete::*)(),
|
||||
decltype(std::bind(
|
||||
std::declval<
|
||||
void(incomplete::*)(request_type&)>(),
|
||||
std::shared_ptr<incomplete>{},
|
||||
std::placeholders::_1))
|
||||
exemplar
|
||||
>();
|
||||
|
||||
struct base
|
||||
@@ -69,28 +73,29 @@ class decorator
|
||||
|
||||
struct none
|
||||
{
|
||||
void
|
||||
operator()(request_type&)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
operator()(response_type&)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template<class T, class = void>
|
||||
struct is_req_op : std::false_type
|
||||
// VFALCO NOTE: When this is two traits, one for
|
||||
// request and one for response,
|
||||
// Visual Studio 2015 fails.
|
||||
|
||||
template<class T, class U, class = void>
|
||||
struct is_op_of : std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_req_op<T, boost::void_t<decltype(
|
||||
std::declval<T&>()(std::declval<request_type&>())
|
||||
)>> : std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template<class T, class = void>
|
||||
struct is_res_op : std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_res_op<T, boost::void_t<decltype(
|
||||
std::declval<T&>()(std::declval<response_type&>())
|
||||
template<class T, class U>
|
||||
struct is_op_of<T, U, boost::void_t<decltype(
|
||||
std::declval<T&>()(std::declval<U&>())
|
||||
)>> : std::true_type
|
||||
{
|
||||
};
|
||||
@@ -120,7 +125,8 @@ class decorator
|
||||
void
|
||||
invoke(request_type& req) override
|
||||
{
|
||||
this->invoke(req, is_req_op<F>{});
|
||||
this->invoke(req,
|
||||
is_op_of<F, request_type>{});
|
||||
}
|
||||
|
||||
void
|
||||
@@ -137,7 +143,8 @@ class decorator
|
||||
void
|
||||
invoke(response_type& res) override
|
||||
{
|
||||
this->invoke(res, is_res_op<F>{});
|
||||
this->invoke(res,
|
||||
is_op_of<F, response_type>{});
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -44,6 +44,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_STATIC_ASSERT(decorator::is_op_of<
|
||||
req_t, request_type>::value);
|
||||
|
||||
struct res_t
|
||||
{
|
||||
bool pass_ = false;
|
||||
@@ -68,6 +71,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_STATIC_ASSERT(decorator::is_op_of<
|
||||
res_t, response_type>::value);
|
||||
|
||||
struct both_t : res_t , req_t
|
||||
{
|
||||
using req_t::operator();
|
||||
@@ -115,14 +121,6 @@ public:
|
||||
decorator d3;
|
||||
d3 = std::move(d2);
|
||||
}
|
||||
|
||||
{
|
||||
// this would be leaner with bind_front
|
||||
decorator d(std::bind(
|
||||
&decorator_test::dec_req, this,
|
||||
std::placeholders::_1));
|
||||
BEAST_EXPECT(d.is_inline());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user