mirror of
https://github.com/boostorg/asio.git
synced 2026-01-27 06:32:08 +00:00
The completion_signature_of trait (and corresponding type alias
completion_signature_of_t) may be used to determine the completion
signature of an asynchronous operation. For example:
auto d = my_timer.async_wait(asio::deferred);
using sig = asio::completion_signature_of<decltype(d)>::type;
// sig is void(error_code)
or with a handcrafted asynchronous operation:
struct my_async_op
{
asio::ip::tcp::socket& socket_ = ...;
template <typename Token>
auto operator()(asio::const_buffer data, Token&& token)
{
return asio::async_write(socket_, data,
std::forward<Token>(token));
}
};
using sig =
asio::completion_signature_of<
my_async_op, asio::const_buffer>::type;
// sig is void(error_code, size_t)
66 KiB
66 KiB