boost::capy::io_task

A task type for I/O operations yielding io_result.

Synopsis

Declared in <boost/capy/io_task.hpp>

template<class... Ts>
using io_task = task<io_result<Ts...>>;

Description

This is a convenience alias for task<io_result<Ts...>>. The converting constructor on io_result<> allows direct co_return of error codes:

io_task<> connect_to_server(socket& s, endpoint ep)
{
    co_return co_await s.connect(ep);  // returns io_result<>
}

io_task<> handler(route_params& rp)
{
    co_return route::next;  // error_code converts to io_result<>
}

Template Parameters

Name Description

Ts

Additional value types beyond error_code.

Created with MrDocs