Modules and Coroutines
Modules and Coroutines
A fast reference to two major C++20 features that need deliberate adoption.
Modules and Coroutines
A fast reference to two major C++20 features that need deliberate adoption.
export module math;
export int add(int a, int b) {
return a + b;
}
import math;
generator<int> countdown(int from) {
while (from > 0) {
co_yield from--;
}
}
co_return finishes with a value.co_yield produces a sequence element.co_await suspends until another awaitable is ready.