◐ Shell
clean mode source ↗

std::uninitialized_copy - cppreference.com

Da cppreference.com.

Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.

La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui.

Click here for the English version of this page

<metanoindex/>

<tbody> </tbody>

Elemento definito nell'header

<memory>

template< class InputIt, class ForwardIt > ForwardIt uninitialized_copy( InputIt first, InputIt last, ForwardIt d_first );

Copia elementi del [first, last) gamma ad un inizio di memoria non inizializzata zona a d_first. Gli elementi della zona non inizializzata sono costruiti utilizzando il costruttore di copia.

Original:

Copies elements from the range [first, last) 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.

Parametri

first, last -

la gamma degli elementi da copiare

Original:

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 -

l'inizio del campo di destinazione

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.

Valore di ritorno

Iterator all'elemento passato l'ultimo elemento copiato.

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.

Complessità

Lineare della distanza tra first e last

Original:

Linear in the distance between first and last

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Possibile implementazione

template<class InputIt, class ForwardIt>
ForwardIt uninitialized_copy(InputIt first, InputIt last, ForwardIt d_first)
{
    typedef typename std::iterator_traits<ForwardIt>::value_type Value;
    for (; first != last; ++first, ++d_first) {
        ::new (static_cast<void*>(&*d_first)) Value(*first);
    }
    return d_first;
}

Esempio

Vedi anche

copia un numero di oggetti da una zona di memoria non inizializzata

Original:

copies a number 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.


(funzione di modello) [modifica]