std::uninitialized_copy
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Заголовочный файл <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.
You can help to correct and verify the translation. Click here for instructions.
Если исключение во время инициализации, функция не имеет эффекта.
| Этот раздел не завершён Причина: update possible implementation to reflect this |
Original:
If an exception is thrown during the initialization, the function has no effects.
| Этот раздел не завершён Причина: update possible implementation to reflect this |
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
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.
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.
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. (шаблон функции) | |