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. |
| Defined in header <memory>
|
||
| template< class InputIt, class Size, class ForwardIt > ForwardIt uninitialized_copy_n( InputIt first, Size count, ForwardIt d_first); |
(C++11 起) | |
副本
countfirst一个未初始化的内存区开始在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. |
| Type requirements | ||
-InputIt must meet the requirements of InputIterator.
| ||
-ForwardIt must meet the requirements of 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; } |
[编辑] 为例
| 本节是不完整的 原因: no example |
[编辑] 另请参阅
| 一个未初始化的内存区域复制的对象范围 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. (函数模板) | |