std::uninitialized_copy
Aus 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. |
definiert in Header <memory>
|
||
template< class InputIt, class Size, class ForwardIt > ForwardIt uninitialized_copy_n( InputIt first, Size count, ForwardIt d_first); |
(seit C++11) | |
Kopien
count
Elemente aus einer Reihe beginnend bei first
auf einen nicht initialisierten Speicherbereich beginnend mit d_first
. Die Elemente in der initialisierten Bereich werden mit Hilfe von Copy-Konstruktor .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.
Wenn eine Ausnahme während der Initialisierung ausgelöst wird, hat die Funktion keine Effekte.
This section is incomplete Reason: update possible implementation to reflect this |
Original:
If an exception is thrown during the initialization, the function has no effects.
This section is incomplete Reason: 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.
Inhaltsverzeichnis |
[Bearbeiten] Parameter
first | - | der Anfang der Reihe der Elemente zu kopieren
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 | - | der Beginn des Zielbereichs
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 .
|
[Bearbeiten] Rückgabewert
Iterator das Element nach dem letzten Element kopiert .
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.
[Bearbeiten] Komplexität
Linear in
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.
[Bearbeiten] Mögliche Implementierung
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; } |
[Bearbeiten] Beispiel
This section is incomplete Reason: no example |
[Bearbeiten] Siehe auch
kopiert eine Folge von Objekten in einen nicht initialisierten Bereich des Speichers (Funktions-Template) |