Applied C++20 Coroutines

By Jim Pascoe

There are a many excellent introductions to C20 coroutines. However, beyond the introductory material, there are few examples of how to apply C20 coroutines in practice. This talk goes beyond the introductory material by providing practical examples of how to design, debug and empirically evaluate coroutines. In particular, this talk shows how to develop a coroutine based web-server using CMake and Boost.Beast (with materials available on GitHub) and how this differs from the more familiar event-driven implementation. The performance of a number of approaches is compared and a series of observations are made.

The aim of this talk is to provide practical guidance for how C20 coroutines can be used in real-world applications. The talk begins by clarifying a number of coroutine concepts before showing how coroutines can be used to implement a web-server and how this differs from the more conventional call-back model (i.e. functions/lambdas). The talk will then show how the performance of coroutines can be evaluated and how new features from C23 can be used to alleviate practical concerns. The talk will conclude with an update on coroutines for C23, as well as a look ahead to C26.

This talk is suitable for users of all levels who are interested in C++20 coroutines (i.e. sufficient introductory material will be covered to make the talk standalone). The slides and example code will be made available on the author’s GitHub page.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.