Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 3475a457cf.
PrevUpHomeNext

Nullary token requirements

A nullary token is a completion token for completion signature void().

Examples

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:

boost::asio::post(...,
    []()
    {
      ...
    });

A non-static class member function adapted to a nullary token using std::bind():

void my_class::nullary_handler()
{
  ...
}
...
boost::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()
{
  ...
}
...
boost::asio::post(...,
    boost::bind(&my_class::nullary_handler, this));

Using use_future as a nullary token:

std::future<void> f = boost::asio::post(..., boost::asio::use_future);
...
f.get();

Using use_awaitable as a nullary token:

boost::asio::awaitable<void> my_coroutine()
{
  ...
  co_await boost::asio::post(..., boost::asio::use_awaitable);
  ...
}

PrevUpHomeNext