Now that we have co_yield working and understand how it works we should be able to quite easily convert our generator to provide iterators so it acts like a normal C++ collection (or range if you're following the ranges TS work).. int main() { for ( auto v : count() ) std::cout << ">> " << v << std::endl; return 0; } The refactoring is pretty much a matter of just moving code around, but there

5960

BY  MATT TUCKER,   CFA  iShares Head of Fixed Income Strategy Lately it feels like all I talk about here on the blog is the potential for rising interest rates – when it might happen, signs that a  rate BY MATT TUCKER, CFA iShares Head

That's even worse than described in the problem. Also, maxiumum optimization was applied ( /O2 ) on a Ryzen 7 3700X. In addition to being able to co_yield a value of type T you can also co_yield a value of type recursive_generator. So when you co_yield a recursive_generator value, all elements of the yielded generator are yielded as elements of the current generator. This simplifies the code above as there is no need for the internal range-for loops. layout: true