Equivalent C++ to Python generator pattern
I've got some example Python code that I need to mimic in C++. I do not require any specific solution (such as co-routine based yield solutions, although they would be acceptable answers as well), I simply need to reproduce the semantics in some manner. Python This is a basic sequence generator, clearly too large to store a materialized version. def pair_sequence(): for i in range(2**32): for j in range(2**32): yield (i, j) The goal is to maintain two instances of the sequence above, and iterate over them in semi-lockstep, but in chunks. In the example below the first_pass uses the sequence of