AnthonyCalandra / modern-cpp-features

A cheatsheet of modern C++ language and library features.
MIT License
19.43k stars 2.06k forks source link

generator<T> is C++23, not C++20 #133

Open jwezel opened 5 months ago

jwezel commented 5 months ago

I saw that in the coroutine chapter in the section C++20, as an example, the generator<T> type was used, but this is only available as of C++23.

AnthonyCalandra commented 5 months ago

I make a note at the bottom of the chapter mentioning this but maybe I should move it to the top instead:

Note: While these examples illustrate how to use coroutines at a basic level, there is lots more going on when the code is compiled. These examples are not meant to be complete coverage of C++20's coroutines. Since the generator and task classes are not provided by the standard library yet, I used the cppcoro library to compile these examples.