Export (0) Print
Expand All

uninitialized_copy_n

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

_First

An input iterator that refers to the object to copy.

_Count

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

_Dest

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

Reference

Other Resources

Community Additions

ADD
Show:
© 2014 Microsoft