◐ Shell
clean mode source ↗

std::uninitialized_fill_n - 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 ForwardIt, class Size, class T > void uninitialized_fill_n( ForwardIt first, Size count, const T& value )

Copies the given value value to the first count elements in an uninitialized memory area beginning at first. The elements in the uninitialized area are constructed using copy constructor.

Parametri

first - the beginning of the range of the elements to initialize
count - number of elements to construct
value -

il valore di costruire gli elementi con

Original:

the value to construct the elements with

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

Type requirements
-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 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.

Possibile implementazione

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

Esempio

Vedi anche

copia di un oggetto ad una zona di memoria non inizializzata

Original:

copies an object 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]