Quantcast
Channel: CodeSection,代码区,Python开发技术文章_教程 - CodeSec
Viewing all articles
Browse latest Browse all 9596

Generating Sequences

$
0
0

A virtual container.

Generating Sequences

ByAnthony 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 and std::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...


Viewing all articles
Browse latest Browse all 9596

Latest Images

Trending Articles