Пространства имён
Варианты
Действия

std::uninitialized_copy

Материал из cppreference.com

 
 
 
Динамическое управление памятью
Низкий уровень управления памятью
Распределители
Original:
Allocators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
allocator
allocator_traits(C++11)
allocator_arg_t(C++11)
allocator_arg(C++11)
uses_allocator(C++11)
scoped_allocator_adaptor(C++11)
Неинициализированные хранения
Original:
Uninitialized storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
uninitialized_copy
uninitialized_copy_n(C++11)
uninitialized_fill
uninitialized_fill_n
raw_storage_iterator
get_temporary_buffer
return_temporary_buffer
Умные указатели
Original:
Smart pointers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
unique_ptr(C++11)
shared_ptr(C++11)
weak_ptr(C++11)
auto_ptr(устарело)
owner_less(C++11)
enable_shared_from_this(C++11)
bad_weak_ptr(C++11)
default_delete(C++11)
Поддержка сборки мусора
Original:
Garbage collection support
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
declare_reachable(C++11)
undeclare_reachable(C++11)
declare_no_pointers(C++11)
undeclare_no_pointers(C++11)
pointer_safety(C++11)
get_pointer_safety(C++11)
Разное
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pointer_traits(C++11)
addressof(C++11)
align(C++11)
C Library
Original:
C Library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
Заголовочный файл <memory>
template< class InputIt, class Size, class ForwardIt >
ForwardIt uninitialized_copy_n( InputIt first, Size count, ForwardIt d_first);
(начиная с C++11)
Копии count элементы из диапазона начиная с first к неинициализированной начало области памяти, в d_first. Элементов в неинициализированный области строятся с использованием конструктора копии.
Original:
Copies count elements from a range beginning at first to an uninitialized memory area beginning at d_first. The elements in the uninitialized area are constructed using copy constructor.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Если исключение во время инициализации, функция не имеет эффекта.
Original:
If an exception is thrown during the initialization, the function has no effects.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Содержание

[править] Параметры

first -
начало диапазона элементов для копирования
Original:
the beginning of the range of the elements to copy
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
d_first -
В начале назначения диапазона
Original:
the beginning of the destination range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Требования, накладываемые на типы
-
InputIt должен соответствовать требованиям InputIterator.
-
ForwardIt должен соответствовать требованиям ForwardIterator.

[править] Возвращаемое значение

Итератор на элемент после последнего элемента скопировал.
Original:
Iterator to the element past the last element copied.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Сложность

Линейный в count.
Original:
Linear in count.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Возможная реализация

template<class InputIt, class Size, class ForwardIt>
ForwardIt uninitialized_copy_n(InputIt first, Size count, ForwardIt d_first)
{
    typedef typename std::iterator_traits<ForwardIt>::value_type Value;
    for (; count > 0; ++first, ++d_first, --count) {
        ::new (static_cast<void*>(&*d_first)) Value(*first);
    }
    return d_first;
}

[править] Пример

[править] См. также

Копирует диапазон объектов неинициализированной области памяти
Original:
copies a range of objects to an uninitialized area of memory
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(шаблон функции) [edit]