Export (0) Print
Expand All


Creates a copy of a specified number of elements from an input iterator. The copies are put in a forward iterator.

template<class InputIterator, class Size, class ForwardIterator>
    ForwardIterator uninitialized_copy_n(
        InputIterator _First, 
        Size _Count,
        ForwardIterator _Dest


An input iterator that refers to the object to copy.


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


A forward iterator that refers to where the new copies go.

A forward iterator that addresses the first position beyond the destination. If the source range was empty, the iterator addresses _First.

The template function effectively executes the following:

for (; 0 < count; -- count)

new ((void *)&* _Dest ++)

iterator_traits<InputIterator>::value_type(* _First ++);

return dest;

unless the code throws an exception. In that case, all constructed objects are destroyed and the exception is rethrown.

Header: <memory>

Namespace: std

© 2014 Microsoft