Copies the first n elements from input to output. absl::c_copy_n(input, n, output) is equivalent to std::copy_n(std::begin(input), n, std::begin(output)).

Synopsis

Declared in <absl/algorithm/container.h>

template<
    typename C,
    typename Size,
    typename OutputRange>
constexpr
/* implementation-defined */
c_copy_n(
    C const& input,
    Size n,
    OutputRange&& output);

Description

The output container must be large enough to hold N elements; this function does not resize output.

If n > std::size(output) or n > std::size(input), behavior is undefined. If std::size(output) > n, only n elements are copied, and output is not truncated.

Return Value

This overload returns no value; the results are written into output.

Parameters

Name

Description

input

The container whose elements to copy.

n

The number of elements to copy.

output

The destination container receiving the copied elements.

Created with MrDocs