[#absl-c_generate_n]
= xref:absl.adoc[absl]::c&lowbar;generate&lowbar;n
:relfileprefix: ../
:mrdocs:

Container&hyphen;based version of the &lt;algorithm&gt; `std&colon;&colon;generate&lowbar;n()` function to assign a container&apos;s first N elements to the values provided by the given generator&period;

== Synopsis

Declared in `&lt;absl&sol;algorithm&sol;container&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename C,
    typename Size,
    typename Generator&gt;
constexpr
&sol;&ast; implementation-defined &ast;&sol;
c&lowbar;generate&lowbar;n(
    C& c,
    Size n,
    Generator&& gen);
----

== Return Value

An iterator one past the last assigned element&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *c*
| The container to fill&period;
| *n*
| The number of elements to assign&period;
| *gen*
| The generator invoked to produce each value&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
