Eliminate redundant copy as executors are now shallow-const.

This commit is contained in:
Christopher Kohlhoff 2017-03-17 07:36:04 +11:00
parent 524288cb4f
commit 00a85845ec
4 changed files with 5 additions and 11 deletions

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();

View File

@ -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();
}