This is improving, even in C++. This is what the core loop of a line-based echo server could look like in C++17 (and something very similar compiles today on my machine)
void echo_loop (tcp::socket socket) {
io::streambuf buffer;
std::string line;
std::error_code ec;
do {
ec = co_await async_read_line (socket, buffer, line);
if (ec)
break;
ec = co_await async_write (socket, line);
} while (!ec);
}