Share via


copy_n

Copies a specified number of elements.

template<class InputIterator, class Size, class OutputIterator>
    OutputIterator copy_n(
        InputIterator  _First, 
        Size _Count,
        OutputIterator _Dest
    );

Parameters

  • _First
    An input iterator that indicates where to copy elements from.

  • _Count
    A signed or unsigned integer type specifying the number of elements to copy.

  • _Dest
    An output iterator that indicates where to copy elements to.

Return Value

Returns an output iterator where elements have been copied to. It is the same as the returned value of the third parameter, _Dest.

Remarks

The template function evaluates *(_Dest + N) = *(_First + N)) once for each N in the range [0, _Count), for strictly increasing values of N starting with the lowest value. It then returns _Dest + N. If _Dest and _First designate regions of storage, _Dest must not be in the range [_First, _Last).

Requirements

Header: <algorithm>

Namespace: std

See Also

Reference

Standard Template Library

Other Resources

<algorithm> Members