mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 12:57:31 +02:00
handler binders use the associated allocator
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
Version 214:
|
||||||
|
|
||||||
|
* handler binders use the associated allocator
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
Version 213:
|
Version 213:
|
||||||
|
|
||||||
* Fix posix_file::close handling of EINTR
|
* Fix posix_file::close handling of EINTR
|
||||||
|
@ -45,6 +45,9 @@ class bind_wrapper
|
|||||||
template<class T, class Executor>
|
template<class T, class Executor>
|
||||||
friend struct net::associated_executor;
|
friend struct net::associated_executor;
|
||||||
|
|
||||||
|
template<class T, class Allocator>
|
||||||
|
friend struct net::associated_allocator;
|
||||||
|
|
||||||
template<class Arg, class Vals>
|
template<class Arg, class Vals>
|
||||||
static
|
static
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
@ -148,31 +151,8 @@ public:
|
|||||||
mp11::index_sequence_for<Args...>());
|
mp11::index_sequence_for<Args...>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// VFALCO I don't think this should be needed,
|
|
||||||
// please let me know if something breaks.
|
|
||||||
/*
|
|
||||||
template<class... Values>
|
|
||||||
void
|
|
||||||
operator()(Values&&... values) const
|
|
||||||
{
|
|
||||||
invoke(h_, args_,
|
|
||||||
tuple<Values&&...>(
|
|
||||||
std::forward<Values>(values)...),
|
|
||||||
mp11::index_sequence_for<Args...>());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
using allocator_type =
|
|
||||||
net::associated_allocator_t<Handler>;
|
|
||||||
|
|
||||||
allocator_type
|
|
||||||
get_allocator() const noexcept
|
|
||||||
{
|
|
||||||
return net::get_associated_allocator(h_);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class Function>
|
template<class Function>
|
||||||
friend
|
friend
|
||||||
void asio_handler_invoke(
|
void asio_handler_invoke(
|
||||||
@ -231,6 +211,9 @@ class bind_front_wrapper
|
|||||||
template<class T, class Executor>
|
template<class T, class Executor>
|
||||||
friend struct net::associated_executor;
|
friend struct net::associated_executor;
|
||||||
|
|
||||||
|
template<class T, class Allocator>
|
||||||
|
friend struct net::associated_allocator;
|
||||||
|
|
||||||
template<std::size_t... I, class... Ts>
|
template<std::size_t... I, class... Ts>
|
||||||
void
|
void
|
||||||
invoke(
|
invoke(
|
||||||
@ -266,15 +249,6 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
using allocator_type =
|
|
||||||
net::associated_allocator_t<Handler>;
|
|
||||||
|
|
||||||
allocator_type
|
|
||||||
get_allocator() const noexcept
|
|
||||||
{
|
|
||||||
return net::get_associated_allocator(h_);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class Function>
|
template<class Function>
|
||||||
friend
|
friend
|
||||||
void asio_handler_invoke(
|
void asio_handler_invoke(
|
||||||
@ -320,13 +294,16 @@ template<class Handler>
|
|||||||
class bind_front_wrapper<
|
class bind_front_wrapper<
|
||||||
Handler, error_code, std::size_t>
|
Handler, error_code, std::size_t>
|
||||||
{
|
{
|
||||||
template<class T, class Executor>
|
|
||||||
friend struct net::associated_executor;
|
|
||||||
|
|
||||||
Handler h_;
|
Handler h_;
|
||||||
error_code ec_;
|
error_code ec_;
|
||||||
std::size_t n_;
|
std::size_t n_;
|
||||||
|
|
||||||
|
template<class T, class Executor>
|
||||||
|
friend struct net::associated_executor;
|
||||||
|
|
||||||
|
template<class T, class Allocator>
|
||||||
|
friend struct net::associated_allocator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using result_type = void; // asio needs this
|
using result_type = void; // asio needs this
|
||||||
|
|
||||||
@ -350,15 +327,6 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
using allocator_type =
|
|
||||||
net::associated_allocator_t<Handler>;
|
|
||||||
|
|
||||||
allocator_type
|
|
||||||
get_allocator() const noexcept
|
|
||||||
{
|
|
||||||
return net::get_associated_allocator(h_);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class Function>
|
template<class Function>
|
||||||
friend
|
friend
|
||||||
void asio_handler_invoke(
|
void asio_handler_invoke(
|
||||||
@ -411,6 +379,9 @@ class bind_back_wrapper
|
|||||||
template<class T, class Executor>
|
template<class T, class Executor>
|
||||||
friend struct net::associated_executor;
|
friend struct net::associated_executor;
|
||||||
|
|
||||||
|
template<class T, class Allocator>
|
||||||
|
friend struct net::associated_allocator;
|
||||||
|
|
||||||
template<std::size_t... I, class... Ts>
|
template<std::size_t... I, class... Ts>
|
||||||
void
|
void
|
||||||
invoke(
|
invoke(
|
||||||
@ -444,15 +415,6 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
using allocator_type =
|
|
||||||
net::associated_allocator_t<Handler>;
|
|
||||||
|
|
||||||
allocator_type
|
|
||||||
get_allocator() const noexcept
|
|
||||||
{
|
|
||||||
return net::get_associated_allocator(h_);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class Function>
|
template<class Function>
|
||||||
friend
|
friend
|
||||||
void asio_handler_invoke(
|
void asio_handler_invoke(
|
||||||
@ -498,13 +460,16 @@ template<class Handler>
|
|||||||
class bind_back_wrapper<
|
class bind_back_wrapper<
|
||||||
Handler, error_code, std::size_t>
|
Handler, error_code, std::size_t>
|
||||||
{
|
{
|
||||||
template<class T, class Executor>
|
|
||||||
friend struct net::associated_executor;
|
|
||||||
|
|
||||||
Handler h_;
|
Handler h_;
|
||||||
error_code ec_;
|
error_code ec_;
|
||||||
std::size_t n_;
|
std::size_t n_;
|
||||||
|
|
||||||
|
template<class T, class Executor>
|
||||||
|
friend struct net::associated_executor;
|
||||||
|
|
||||||
|
template<class T, class Allocator>
|
||||||
|
friend struct net::associated_allocator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using result_type = void; // asio needs this
|
using result_type = void; // asio needs this
|
||||||
|
|
||||||
@ -528,15 +493,6 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
using allocator_type =
|
|
||||||
net::associated_allocator_t<Handler>;
|
|
||||||
|
|
||||||
allocator_type
|
|
||||||
get_allocator() const noexcept
|
|
||||||
{
|
|
||||||
return net::get_associated_allocator(h_);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class Function>
|
template<class Function>
|
||||||
friend
|
friend
|
||||||
void asio_handler_invoke(
|
void asio_handler_invoke(
|
||||||
@ -595,7 +551,7 @@ struct associated_executor<
|
|||||||
static
|
static
|
||||||
type
|
type
|
||||||
get(beast::detail::bind_wrapper<Handler, Args...> const& op,
|
get(beast::detail::bind_wrapper<Handler, Args...> const& op,
|
||||||
Executor const& ex = Executor()) noexcept
|
Executor const& ex = Executor{}) noexcept
|
||||||
{
|
{
|
||||||
return associated_executor<
|
return associated_executor<
|
||||||
Handler, Executor>::get(op.h_, ex);
|
Handler, Executor>::get(op.h_, ex);
|
||||||
@ -612,7 +568,7 @@ struct associated_executor<
|
|||||||
static
|
static
|
||||||
type
|
type
|
||||||
get(beast::detail::bind_front_wrapper<Handler, Args...> const& op,
|
get(beast::detail::bind_front_wrapper<Handler, Args...> const& op,
|
||||||
Executor const& ex = Executor()) noexcept
|
Executor const& ex = Executor{}) noexcept
|
||||||
{
|
{
|
||||||
return associated_executor<
|
return associated_executor<
|
||||||
Handler, Executor>::get(op.h_, ex);
|
Handler, Executor>::get(op.h_, ex);
|
||||||
@ -629,13 +585,66 @@ struct associated_executor<
|
|||||||
static
|
static
|
||||||
type
|
type
|
||||||
get(beast::detail::bind_back_wrapper<Handler, Args...> const& op,
|
get(beast::detail::bind_back_wrapper<Handler, Args...> const& op,
|
||||||
Executor const& ex = Executor()) noexcept
|
Executor const& ex = Executor{}) noexcept
|
||||||
{
|
{
|
||||||
return associated_executor<
|
return associated_executor<
|
||||||
Handler, Executor>::get(op.h_, ex);
|
Handler, Executor>::get(op.h_, ex);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
template<class Handler, class... Args, class Allocator>
|
||||||
|
struct associated_allocator<
|
||||||
|
beast::detail::bind_wrapper<Handler, Args...>, Allocator>
|
||||||
|
{
|
||||||
|
using type = typename
|
||||||
|
associated_allocator<Handler, Allocator>::type;
|
||||||
|
|
||||||
|
static
|
||||||
|
type
|
||||||
|
get(beast::detail::bind_wrapper<Handler, Args...> const& op,
|
||||||
|
Allocator const& alloc = Allocator{}) noexcept
|
||||||
|
{
|
||||||
|
return associated_allocator<
|
||||||
|
Handler, Allocator>::get(op.h_, alloc);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Handler, class... Args, class Allocator>
|
||||||
|
struct associated_allocator<
|
||||||
|
beast::detail::bind_front_wrapper<Handler, Args...>, Allocator>
|
||||||
|
{
|
||||||
|
using type = typename
|
||||||
|
associated_allocator<Handler, Allocator>::type;
|
||||||
|
|
||||||
|
static
|
||||||
|
type
|
||||||
|
get(beast::detail::bind_front_wrapper<Handler, Args...> const& op,
|
||||||
|
Allocator const& alloc = Allocator{}) noexcept
|
||||||
|
{
|
||||||
|
return associated_allocator<
|
||||||
|
Handler, Allocator>::get(op.h_, alloc);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Handler, class... Args, class Allocator>
|
||||||
|
struct associated_allocator<
|
||||||
|
beast::detail::bind_back_wrapper<Handler, Args...>, Allocator>
|
||||||
|
{
|
||||||
|
using type = typename
|
||||||
|
associated_allocator<Handler, Allocator>::type;
|
||||||
|
|
||||||
|
static
|
||||||
|
type
|
||||||
|
get(beast::detail::bind_back_wrapper<Handler, Args...> const& op,
|
||||||
|
Allocator const& alloc = Allocator{}) noexcept
|
||||||
|
{
|
||||||
|
return associated_allocator<
|
||||||
|
Handler, Allocator>::get(op.h_, alloc);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // asio
|
} // asio
|
||||||
} // boost
|
} // boost
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user