template <class OutputIterator, class Size, class Generator> OutputIterator generate_n(OutputIterator first, Size n, Generator gen);DescriptionGenerate_n assigns the result of invoking gen, a function object that takes no arguments, to each element in the range [first, first+n). [1] The return value is first + n. Definition Defined in the standard header algorithm, and in the nonstandard backward-compatibility header algo.h. Requirements on types
generate_n(ostream_iterator<int>(cout, "\n"), 100, rand);Notes
[1] The function object gen is invoked n times (once for each iterator in the range [first, first+n)), as opposed to just being invoked a single time outside the loop. This distinction is important because a Generator need not return the same result each time it is invoked; it is permitted to read from a file, refer to and modify local state, and so on.
See alsocopy, fill, fill_n, generate, iota STL Main PageRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4