Standard C++ generator
The code below demonstrates how standard C++23 synchronous generator works:
#include <boost/cobalt.hpp>
#include <iostream>
#include <generator>
namespace cobalt = boost::cobalt;
std::generator<int> numbers()
{
for (int i = 1; i <= 5; ++i)
{
co_yield i;
}
}