A nullary token is a completion
token for completion signature void()
.
A free function as a nullary token:
void nullary_handler() { ... }
A nullary token function object:
struct nullary_handler { ... void operator()() { ... } ... };
A lambda as a nullary token:
asio::post(..., []() { ... });
A non-static class member function adapted to a nullary token using std::bind()
:
void my_class::nullary_handler() { ... } ... asio::post(..., std::bind(&my_class::nullary_handler, this));
A non-static class member function adapted to a nullary token using boost::bind()
:
void my_class::nullary_handler() { ... } ... asio::post(..., boost::bind(&my_class::nullary_handler, this));
Using use_future as a nullary token:
std::future<void> f = asio::post(..., asio::use_future); ... f.get();
Using use_awaitable as a nullary token:
asio::awaitable<void> my_coroutine() { ... co_await asio::post(..., asio::use_awaitable); ... }