Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.



Copies a specified number of elements.

template<class InputIterator, class Size, class OutputIterator>
OutputIterator copy_n(InputIterator first, Size count, OutputIterator dest);


An input iterator that indicates where to copy elements from.


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


An output iterator that indicates where to copy elements to.

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

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).


Header: <algorithm>

Namespace: std

© 2016 Microsoft