Example of adapting an async_generator
to use with std::ranges
.
#include <iostream>
#include <ranges>
namespace {
{
for (int i = start;; ++i) {
co_yield i;
}
}
}
int main()
{
for (const auto& n : sync_iota | std::views::take(5)) {
std::cout << n << "\n";
}
return 0;
}
An asynchronous generator that produces values of type Result.
Adapter for converting asynchronous generators to synchronous generators.
Adapter for converting asynchronous generators to synchronous generators.