Eliminate redundant copy as executors are now shallow-const.
This commit is contained in:
parent
524288cb4f
commit
00a85845ec
@ -52,10 +52,10 @@ public:
|
||||
|
||||
void operator()()
|
||||
{
|
||||
typename associated_executor<Handler>::type ex(work_.get_executor());
|
||||
typename associated_allocator<Handler>::type alloc(
|
||||
(get_associated_allocator)(handler_));
|
||||
ex.dispatch(ASIO_MOVE_CAST(Handler)(handler_), alloc);
|
||||
work_.get_executor().dispatch(
|
||||
ASIO_MOVE_CAST(Handler)(handler_), alloc);
|
||||
work_.reset();
|
||||
}
|
||||
|
||||
|
@ -52,12 +52,10 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) defer(
|
||||
|
||||
async_completion<CompletionToken, void()> init(token);
|
||||
|
||||
Executor ex1(ex);
|
||||
|
||||
typename associated_allocator<handler>::type alloc(
|
||||
(get_associated_allocator)(init.completion_handler));
|
||||
|
||||
ex1.defer(detail::work_dispatcher<handler>(init.completion_handler), alloc);
|
||||
ex.defer(detail::work_dispatcher<handler>(init.completion_handler), alloc);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
@ -52,12 +52,10 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) dispatch(
|
||||
|
||||
async_completion<CompletionToken, void()> init(token);
|
||||
|
||||
Executor ex1(ex);
|
||||
|
||||
typename associated_allocator<handler>::type alloc(
|
||||
(get_associated_allocator)(init.completion_handler));
|
||||
|
||||
ex1.dispatch(detail::work_dispatcher<handler>(
|
||||
ex.dispatch(detail::work_dispatcher<handler>(
|
||||
init.completion_handler), alloc);
|
||||
|
||||
return init.result.get();
|
||||
|
@ -52,12 +52,10 @@ ASIO_INITFN_RESULT_TYPE(CompletionToken, void()) post(
|
||||
|
||||
async_completion<CompletionToken, void()> init(token);
|
||||
|
||||
Executor ex1(ex);
|
||||
|
||||
typename associated_allocator<handler>::type alloc(
|
||||
(get_associated_allocator)(init.completion_handler));
|
||||
|
||||
ex1.post(detail::work_dispatcher<handler>(init.completion_handler), alloc);
|
||||
ex.post(detail::work_dispatcher<handler>(init.completion_handler), alloc);
|
||||
|
||||
return init.result.get();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user