Add overloads of all forwarding invocation hooks that take a non-const reference to the function object.
This commit is contained in:
parent
e47a3087d3
commit
954f83f037
@ -71,6 +71,14 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Handler, typename Arg1>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
binder1<Handler, Arg1>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Handler, typename Arg1>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
binder1<Handler, Arg1>* this_handler)
|
||||
@ -137,6 +145,14 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Handler, typename Arg1, typename Arg2>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
binder2<Handler, Arg1, Arg2>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Handler, typename Arg1, typename Arg2>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
binder2<Handler, Arg1, Arg2>* this_handler)
|
||||
@ -209,6 +225,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Handler, typename Arg1, typename Arg2,
|
||||
typename Arg3>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
binder3<Handler, Arg1, Arg2, Arg3>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Handler, typename Arg1, typename Arg2,
|
||||
typename Arg3>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
@ -289,6 +314,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Handler, typename Arg1, typename Arg2,
|
||||
typename Arg3, typename Arg4>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Handler, typename Arg1, typename Arg2,
|
||||
typename Arg3, typename Arg4>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
@ -376,6 +410,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Handler, typename Arg1, typename Arg2,
|
||||
typename Arg3, typename Arg4, typename Arg5>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Handler, typename Arg1, typename Arg2,
|
||||
typename Arg3, typename Arg4, typename Arg5>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
|
@ -27,6 +27,19 @@
|
||||
// namespace is defined here for that purpose.
|
||||
namespace asio_handler_invoke_helpers {
|
||||
|
||||
template <typename Function, typename Context>
|
||||
inline void invoke(Function& function, Context& context)
|
||||
{
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \
|
||||
|| BOOST_WORKAROUND(__GNUC__, < 3)
|
||||
Function tmp(function);
|
||||
tmp();
|
||||
#else
|
||||
using namespace asio;
|
||||
asio_handler_invoke(function, boost::addressof(context));
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename Function, typename Context>
|
||||
inline void invoke(const Function& function, Context& context)
|
||||
{
|
||||
|
@ -259,6 +259,17 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Protocol,
|
||||
typename SocketService, typename Iterator,
|
||||
typename ConnectCondition, typename ComposedConnectHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
connect_op<Protocol, SocketService, Iterator,
|
||||
ConnectCondition, ComposedConnectHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Protocol,
|
||||
typename SocketService, typename Iterator,
|
||||
typename ConnectCondition, typename ComposedConnectHandler>
|
||||
|
@ -258,6 +258,17 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream,
|
||||
typename MutableBufferSequence, typename CompletionCondition,
|
||||
typename ReadHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
read_op<AsyncReadStream, MutableBufferSequence,
|
||||
CompletionCondition, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream,
|
||||
typename MutableBufferSequence, typename CompletionCondition,
|
||||
typename ReadHandler>
|
||||
@ -374,6 +385,16 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream,
|
||||
typename Allocator, typename CompletionCondition, typename ReadHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
read_streambuf_op<AsyncReadStream, Allocator,
|
||||
CompletionCondition, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream,
|
||||
typename Allocator, typename CompletionCondition, typename ReadHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
|
@ -276,6 +276,17 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncRandomAccessReadDevice,
|
||||
typename MutableBufferSequence, typename CompletionCondition,
|
||||
typename ReadHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence,
|
||||
CompletionCondition, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncRandomAccessReadDevice,
|
||||
typename MutableBufferSequence, typename CompletionCondition,
|
||||
typename ReadHandler>
|
||||
@ -397,6 +408,16 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncRandomAccessReadDevice,
|
||||
typename Allocator, typename CompletionCondition, typename ReadHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
|
||||
CompletionCondition, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncRandomAccessReadDevice,
|
||||
typename Allocator, typename CompletionCondition, typename ReadHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
|
@ -430,6 +430,16 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream, typename Allocator,
|
||||
typename ReadHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
read_until_delim_op<AsyncReadStream,
|
||||
Allocator, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream, typename Allocator,
|
||||
typename ReadHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
@ -578,6 +588,16 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream,
|
||||
typename Allocator, typename ReadHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
read_until_delim_string_op<AsyncReadStream,
|
||||
Allocator, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream,
|
||||
typename Allocator, typename ReadHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
@ -733,6 +753,16 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream, typename Allocator,
|
||||
typename RegEx, typename ReadHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
read_until_expr_op<AsyncReadStream,
|
||||
Allocator, RegEx, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream, typename Allocator,
|
||||
typename RegEx, typename ReadHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
@ -884,6 +914,16 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream, typename Allocator,
|
||||
typename MatchCondition, typename ReadHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
read_until_match_op<AsyncReadStream,
|
||||
Allocator, MatchCondition, ReadHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncReadStream, typename Allocator,
|
||||
typename MatchCondition, typename ReadHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
|
@ -295,6 +295,17 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncWriteStream,
|
||||
typename ConstBufferSequence, typename CompletionCondition,
|
||||
typename WriteHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
write_op<AsyncWriteStream, ConstBufferSequence,
|
||||
CompletionCondition, WriteHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncWriteStream,
|
||||
typename ConstBufferSequence, typename CompletionCondition,
|
||||
typename WriteHandler>
|
||||
@ -385,6 +396,16 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncWriteStream, typename Allocator,
|
||||
typename WriteHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
write_streambuf_handler<AsyncWriteStream,
|
||||
Allocator, WriteHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncWriteStream, typename Allocator,
|
||||
typename WriteHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
|
@ -312,6 +312,17 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncRandomAccessWriteDevice,
|
||||
typename ConstBufferSequence, typename CompletionCondition,
|
||||
typename WriteHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence,
|
||||
CompletionCondition, WriteHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncRandomAccessWriteDevice,
|
||||
typename ConstBufferSequence, typename CompletionCondition,
|
||||
typename WriteHandler>
|
||||
@ -405,6 +416,16 @@ namespace detail
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncRandomAccessWriteDevice,
|
||||
typename Allocator, typename WriteHandler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
write_at_streambuf_op<AsyncRandomAccessWriteDevice,
|
||||
Allocator, WriteHandler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename AsyncRandomAccessWriteDevice,
|
||||
typename Allocator, typename WriteHandler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
|
@ -269,6 +269,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
pointer, size, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Stream,
|
||||
typename Operation, typename Handler>
|
||||
inline void asio_handler_invoke(Function& function,
|
||||
io_op<Stream, Operation, Handler>* this_handler)
|
||||
{
|
||||
asio_handler_invoke_helpers::invoke(
|
||||
function, this_handler->handler_);
|
||||
}
|
||||
|
||||
template <typename Function, typename Stream,
|
||||
typename Operation, typename Handler>
|
||||
inline void asio_handler_invoke(const Function& function,
|
||||
|
Loading…
Reference in New Issue
Block a user