Towards a basic C++20 core example for a sequenced async coroutines.
This website tries to come up with a basis sequenced async coroutine example we all can use to learn and teach.
I am not alone, a lot of programmers want to to that:
Lewis Baker 2017:
https://lewissbaker.github.io/2017/11/17/understanding-operator-co-await
Lewis Baker 2020:
https://lewissbaker.github.io/2020/05/11/understanding_symmetric_transfer
Frank Birbacher:
https://github.com/birbacher/isocpp-corotask
with a nice tracer for awaiters:
https://github.com/birbacher/isocpp-corotask/blob/main/src/traced.hpp
Björn Fahller:
https://speakerdeck.com/rollbear/o-and-coroutines-for-smooth-data-streaming (video/slides)
Charles Tolman:
https://gitlab.com/charlest_uk/scheduler_demo
based on initial code I presented in my ACCU 2020 C++20 tutorial
Phil Nash and Nico Josuttis (me) came up with a first example in a joined evening session at ACCU 2020:
https://github.com/josuttis/cppcoro/blob/main/async_nico_phil/async4.cpp
Here, we especially tried to understand what's going on by placing several log statements
Micha Eiler came up with an incredible well explained example using all new C++20 features:
https://blog.eiler.eu/posts/20210512/
- code step1: https://gist.github.com/MichaEiler/b13771a9e0e403d8a0a082072fd14d68
- code step2: https://gist.github.com/MichaEiler/99c3ed529d4fd19c4289fd04672a1a7c)
Others:
https://www.scs.stanford.edu/~dm/blog/c++-coroutines.html
https://www.jeremyong.com/cpp/2021/01/04/cpp20-coroutines-a-minimal-async-framework/
https://mariusbancila.ro/blog/2020/06/22/a-cpp20-coroutine-example/
For basic details of how C++20 coroutines (concepts and examples) see
C++20 - The Complete Guide by Nicolai M. Josuttis
I am happy about any constructive feedback. Please use the feedback address of my C++20 book: http://cppstd20.com/feedback
The code is licensed under a Creative Commons Attribution 4.0 International License.