Fix experimental::as_single to work with handler hook deprecation.

This commit is contained in:
Christopher Kohlhoff 2020-12-29 18:52:06 +11:00
parent 439448326c
commit 180bc40ea0

View File

@ -75,19 +75,29 @@ public:
};
template <typename Handler>
inline void* asio_handler_allocate(std::size_t size,
inline asio_handler_allocate_is_deprecated
asio_handler_allocate(std::size_t size,
as_single_handler<Handler>* this_handler)
{
#if defined(ASIO_NO_DEPRECATED)
asio_handler_alloc_helpers::allocate(size, this_handler->handler_);
return asio_handler_allocate_is_no_longer_used();
#else // defined(ASIO_NO_DEPRECATED)
return asio_handler_alloc_helpers::allocate(
size, this_handler->handler_);
#endif // defined(ASIO_NO_DEPRECATED)
}
template <typename Handler>
inline void asio_handler_deallocate(void* pointer, std::size_t size,
inline asio_handler_deallocate_is_deprecated
asio_handler_deallocate(void* pointer, std::size_t size,
as_single_handler<Handler>* this_handler)
{
asio_handler_alloc_helpers::deallocate(
pointer, size, this_handler->handler_);
#if defined(ASIO_NO_DEPRECATED)
return asio_handler_deallocate_is_no_longer_used();
#endif // defined(ASIO_NO_DEPRECATED)
}
template <typename Handler>
@ -99,19 +109,27 @@ inline bool asio_handler_is_continuation(
}
template <typename Function, typename Handler>
inline void asio_handler_invoke(Function& function,
inline asio_handler_invoke_is_deprecated
asio_handler_invoke(Function& function,
as_single_handler<Handler>* this_handler)
{
asio_handler_invoke_helpers::invoke(
function, this_handler->handler_);
#if defined(ASIO_NO_DEPRECATED)
return asio_handler_invoke_is_no_longer_used();
#endif // defined(ASIO_NO_DEPRECATED)
}
template <typename Function, typename Handler>
inline void asio_handler_invoke(const Function& function,
inline asio_handler_invoke_is_deprecated
asio_handler_invoke(const Function& function,
as_single_handler<Handler>* this_handler)
{
asio_handler_invoke_helpers::invoke(
function, this_handler->handler_);
#if defined(ASIO_NO_DEPRECATED)
return asio_handler_invoke_is_no_longer_used();
#endif // defined(ASIO_NO_DEPRECATED)
}
template <typename Signature>