Skip to content

Instantly share code, notes, and snippets.

@PSIAlt
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PSIAlt/d4c9ccf48b962f797efd to your computer and use it in GitHub Desktop.
Save PSIAlt/d4c9ccf48b962f797efd to your computer and use it in GitHub Desktop.
template <class CompletionToken>
RequestResult async_foo(Packet &pkt, CompletionToken&& token) {
typename boost::asio::handler_type< CompletionToken, RequestResult >::type handler( std::forward<CompletionToken>(token) );
boost::asio::async_result<decltype(handler)> result(handler);
conn->writePacket(pkt, handler);
return result.get();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment