Closed kilasuelika closed 5 days ago
Yes, because you are creating a new generator when you call next(5)
and then destroying it rightaway.
cobalt::main co_main(int argc, char* argv[]) {
auto g = next(5);
while (auto x = co_await g) {
std::println(std::cout, "got {}", x.value());
}
co_return 0;
}
That should do it.
Following code:
In my MSVC, the console keeps showing "getting 0" and never finished. Seems the
i
is not incremented. Is this a desired behavior?