Boost logo

Boost :

From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2022-01-01 14:50:41


On Thu, Dec 30, 2021 at 4:22 PM Andrzej Krzemienski via Boost
<boost_at_[hidden]> wrote:
> So I would expect the name `CompletionToken` to appear in the documentation
> of `async_write`. Am I missing something?

Yes. The overload is the first one:

template<
    typename AsyncWriteStream,
    typename ConstBufferSequence,
    typename WriteHandler = DEFAULT>
DEDUCED async_write(
    AsyncWriteStream & s,
    const ConstBufferSequence & buffers,
    WriteHandler && handler = DEFAULT,
    ....

"WriteHandler" actually means "CompletionToken" in this context. I
think it is for legacy reasons. In any event, all initiating functions
follow the rules described here:

https://www.boost.org/doc/libs/1_78_0/doc/html/boost_asio/reference/asynchronous_operations.html#boost_asio.reference.asynchronous_operations.completion_tokens_and_handlers

Any time "handler" appears in an initiating function signature, it
accepts a completion token for that argument. Beast follows this
convention as well. I agree that the documentation needs work.

Thanks


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk