[/
 / Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 /
 / Distributed under the Boost Software License, Version 1.0. (See accompanying
 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 /]

[section:NullaryToken Nullary token requirements]

A nullary token is a [link asio.overview.model.completion_tokens completion
token] for completion signature `void()`.

[heading 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:

  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 [link asio.reference.use_future use_future] as a nullary token:

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

Using [link asio.reference.use_awaitable use_awaitable] as a nullary token:

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

[endsect]
