Container‐based version of the <algorithm> std::generate_n() function to assign a container's first N elements to the values provided by the given generator.

Synopsis

Declared in <absl/algorithm/container.h>

template<
    typename C,
    typename Size,
    typename Generator>
constexpr
/* implementation-defined */
c_generate_n(
    C& c,
    Size n,
    Generator&& gen);

Return Value

An iterator one past the last assigned element.

Parameters

Name

Description

c

The container to fill.

n

The number of elements to assign.

gen

The generator invoked to produce each value.

Created with MrDocs