Handler invoke and allocation hooks are deprecated

This commit is contained in:
Christopher Kohlhoff
2020-06-23 09:49:17 +10:00
committed by Richard Hodges
parent 6f57e5934c
commit 22f2f5dcf4
4 changed files with 55 additions and 33 deletions

View File

@ -1,3 +1,7 @@
* Handler invoke and allocation hooks are deprecated.
--------------------------------------------------------------------------------
Version 297:
* iless and iequal take part in Heterogeneous Lookup

View File

@ -67,6 +67,10 @@ public:
h_, this->get());
}
// The invocation hook is no longer defined because it customises behaviour
// without forwarding to a user's hook.
#if 0
template<class Function>
void
asio_handler_invoke(Function&& f,
@ -74,23 +78,30 @@ public:
{
net::dispatch(p->get_executor(), std::move(f));
}
#endif
// The allocation hooks are still defined because they trivially forward to
// user hooks. Forward here ensures that the user will get a compile error
// if they build their code with BOOST_ASIO_NO_DEPRECATED.
friend
void* asio_handler_allocate(
boost::asio::asio_handler_allocate_is_deprecated
asio_handler_allocate(
std::size_t size, bind_default_executor_wrapper* p)
{
using net::asio_handler_allocate;
using boost::asio::asio_handler_allocate;
return asio_handler_allocate(
size, std::addressof(p->h_));
}
friend
void asio_handler_deallocate(
boost::asio::asio_handler_deallocate_is_deprecated
asio_handler_deallocate(
void* mem, std::size_t size,
bind_default_executor_wrapper* p)
{
using net::asio_handler_deallocate;
asio_handler_deallocate(mem, size,
using boost::asio::asio_handler_deallocate;
return asio_handler_deallocate(mem, size,
std::addressof(p->h_));
}
@ -98,7 +109,7 @@ public:
bool asio_handler_is_continuation(
bind_default_executor_wrapper* p)
{
using net::asio_handler_is_continuation;
using boost::asio::asio_handler_is_continuation;
return asio_handler_is_continuation(
std::addressof(p->h_));
}

View File

@ -155,37 +155,40 @@ public:
template<class Function>
friend
void asio_handler_invoke(
boost::asio::asio_handler_invoke_is_deprecated
asio_handler_invoke(
Function&& f, bind_wrapper* op)
{
using net::asio_handler_invoke;
asio_handler_invoke(f, std::addressof(op->h_));
using boost::asio::asio_handler_invoke;
return asio_handler_invoke(f, std::addressof(op->h_));
}
friend
bool asio_handler_is_continuation(
bind_wrapper* op)
{
using net::asio_handler_is_continuation;
using boost::asio::asio_handler_is_continuation;
return asio_handler_is_continuation(
std::addressof(op->h_));
}
friend
void* asio_handler_allocate(
boost::asio::asio_handler_allocate_is_deprecated
asio_handler_allocate(
std::size_t size, bind_wrapper* op)
{
using net::asio_handler_allocate;
using boost::asio::asio_handler_allocate;
return asio_handler_allocate(
size, std::addressof(op->h_));
}
friend
void asio_handler_deallocate(
boost::asio::asio_handler_deallocate_is_deprecated
asio_handler_deallocate(
void* p, std::size_t size, bind_wrapper* op)
{
using net::asio_handler_deallocate;
asio_handler_deallocate(
using boost::asio::asio_handler_deallocate;
return asio_handler_deallocate(
p, size, std::addressof(op->h_));
}
};
@ -265,37 +268,40 @@ public:
template<class Function>
friend
void asio_handler_invoke(
boost::asio::asio_handler_invoke_is_deprecated
asio_handler_invoke(
Function&& f, bind_front_wrapper* op)
{
using net::asio_handler_invoke;
asio_handler_invoke(f, std::addressof(op->h_));
using boost::asio::asio_handler_invoke;
return asio_handler_invoke(f, std::addressof(op->h_));
}
friend
bool asio_handler_is_continuation(
bind_front_wrapper* op)
{
using net::asio_handler_is_continuation;
using boost::asio::asio_handler_is_continuation;
return asio_handler_is_continuation(
std::addressof(op->h_));
}
friend
void* asio_handler_allocate(
boost::asio::asio_handler_allocate_is_deprecated
asio_handler_allocate(
std::size_t size, bind_front_wrapper* op)
{
using net::asio_handler_allocate;
using boost::asio::asio_handler_allocate;
return asio_handler_allocate(
size, std::addressof(op->h_));
}
friend
void asio_handler_deallocate(
boost::asio::asio_handler_deallocate_is_deprecated
asio_handler_deallocate(
void* p, std::size_t size, bind_front_wrapper* op)
{
using net::asio_handler_deallocate;
asio_handler_deallocate(
using boost::asio::asio_handler_deallocate;
return asio_handler_deallocate(
p, size, std::addressof(op->h_));
}
};

View File

@ -55,12 +55,13 @@ template<
class Executor1,
class Allocator,
class Function>
void asio_handler_invoke(
boost::asio::asio_handler_invoke_is_deprecated
asio_handler_invoke(
Function&& f,
async_base<Handler, Executor1, Allocator>* p)
{
using net::asio_handler_invoke;
asio_handler_invoke(f,
using boost::asio::asio_handler_invoke;
return asio_handler_invoke(f,
p->get_legacy_handler_pointer());
}
@ -68,12 +69,12 @@ template<
class Handler,
class Executor1,
class Allocator>
void*
boost::asio::asio_handler_allocate_is_deprecated
asio_handler_allocate(
std::size_t size,
async_base<Handler, Executor1, Allocator>* p)
{
using net::asio_handler_allocate;
using boost::asio::asio_handler_allocate;
return asio_handler_allocate(size,
p->get_legacy_handler_pointer());
}
@ -82,13 +83,13 @@ template<
class Handler,
class Executor1,
class Allocator>
void
boost::asio::asio_handler_deallocate_is_deprecated
asio_handler_deallocate(
void* mem, std::size_t size,
async_base<Handler, Executor1, Allocator>* p)
{
using net::asio_handler_deallocate;
asio_handler_deallocate(mem, size,
using boost::asio::asio_handler_deallocate;
return asio_handler_deallocate(mem, size,
p->get_legacy_handler_pointer());
}
@ -100,7 +101,7 @@ bool
asio_handler_is_continuation(
async_base<Handler, Executor1, Allocator>* p)
{
using net::asio_handler_is_continuation;
using boost::asio::asio_handler_is_continuation;
return asio_handler_is_continuation(
p->get_legacy_handler_pointer());
}