Declaration
template <class ForwardIterator, class Generator> void generate(ForwardIterator first, ForwardIterator last, Generator gen); template <class OutputIterator, class Size, class Generator> void generate_n(OutputIterator first, Size n, Generator gen);
Description The generate function fills the range [ first, last) with the sequence generated by n successive calls to gen, where n is the size of the range [ first, last) .
The generate_n function fills the range of size n beginning at first with the sequence generated by n successive calls to gen.
Type requirements
Group Mutating sequence operations.
Time complexity Linear.
The number of assignments is n, where n is the size of the range [ first, last) for the generate function, and is n for the generate_n function.
Space complexity Constant.
Mutative? Yes.
Example Select here to view the source code for the example.
Implementation Select here to view source code (Copyright (C) 1994, Hewlett-Packard Company) for this algorithm.