A virtual container.
Generating Sequences
By Anthony Williams
From the article:
I was having a discussion with my son over breakfast about C++ and Python, and he asked me if C++ had anything equivalent to Python's
range()
function for generating a sequence of integers. I had to tell him that no, the C++ standard library didn't supply such a function, but there were algorithms for generating sequences (std::generate
andstd::generate_n
) into an existing container, and you could write something that would provide a "virtual" container that would supply a sequence as you iterated over it with range-for...
Add a Comment
Comments are closed.