Skip to content

Add default completion token for asio::deferred_async_operation #1728

@TCPLK

Description

@TCPLK

Asynchronous operation composed using asio::deferred and the pipe operator still require asio::deferred to be passed explicitly when invoked

auto timeout_read = socket.async_read_some(asio::buffer(buf)) | asio::cancel_after(timer, 1s);

auto read_size = co_await timeout_read(asio::deferred);  // ok
auto read_size = co_await timeout_read();  // compile failed

Adding a default completion token to asio::deferred_async_operation to align with other asio asynchronous functions would improve usability, especially when using coroutines

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions