template<class ForwardIterator, class Generator>
void generate(ForwardIterator first, ForwardIterator last,
Generator gen);
template<class ExecutionPolicy, class ForwardIterator, class Generator>
void generate(ExecutionPolicy&& exec,
ForwardIterator first, ForwardIterator last,
Generator gen);
template<class OutputIterator, class Size, class Generator>
OutputIterator generate_n(OutputIterator first, Size n, Generator gen);
template<class ExecutionPolicy, class ForwardIterator, class Size, class Generator>
ForwardIterator generate_n(ExecutionPolicy&& exec,
ForwardIterator first, Size n, Generator gen);
Effects:
The
generate algorithms invoke the function object
gen and assign the return
value of
gen through all the iterators in the range
[first, last). The
generate_n algorithms invoke the function object
gen and assign the return value of
gen through all the iterators in
the range
[first, first + n) if
n is positive,
otherwise they do nothing
.Returns: generate_n returns
first + n for non-negative values of
n
and
first for negative values
. Complexity:
Exactly
last - first,
n, or 0
invocations of
gen and assignments, respectively
.