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