cpp/algorithm/ranges/generate n

Assigns the result of successive invocations of the function object to each element in the range, if. Does nothing otherwise.

Return value
Iterator one past the last element assigned if, otherwise.

Complexity
Exactly invocations of  and assignments.