cppcoro
cppcoro copied to clipboard
async_generator example in README
https://github.com/lewissbaker/cppcoro#async_generatort
uses some type called "threadpool" with a member function named "delay". Even if the type were supposed to be cppcoro::static_thread_pool, static_thread_pool still doesn't have any member named "delay".
The example at the moment is:
cppcoro::async_generator<int> ticker(int count, threadpool& tp)
{
for (int i = 0; i < count; ++i)
{
co_await tp.delay(std::chrono::seconds(1));
co_yield i;
}
}
cppcoro::task<> consumer(threadpool& tp)
{
auto sequence = ticker(10, tp);
for co_await(std::uint32_t i : sequence)
{
std::cout << "Tick " << i << std::endl;
}
}
It would be nice if the example were modified (hopefully just slightly?) to be compileable.