I found this interesting link boost::asio::spawn yield as callback
and since that might be what I need I wanted to try out the following part:
template <class CompletionToken>
auto async_foo(uint64_t item_id, CompletionToken&& token)
{
typename boost::asio::handler_type< CompletionToken, void(error_code, size_t) >::type handler(std::forward<CompletionToken>(token));
//handler_type_t<CompletionToken, void(error_code, size_t)> handler(std::forward<CompletionToken>(token));
async_result<decltype(handler)> result(handler);
//async_request_data(item_id, handler);
return result.get();
}
But obviously neither handler_type_t
nor boost::asio::handler_type
is existing anymore in a newer boost version.
How can I adapt the example?
EDIT:
Is that he right way? Instead of
boost::asio::handler_type< CompletionToken, void(error_code, size_t) >::type
I used
typename boost::asio::async_result< CompletionToken, void(error_code, size_t) >::completion_handler_type