std::deque::assign
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. |
| void assign( size_type count, const T& value ); |
(1) | |
| template< class InputIt > void assign( InputIt first, InputIt last ); |
(2) | |
Sostituisce il contenuto del contenitore.
1) Original:
Replaces the contents of the container.
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.
sostituisce il contenuto con le copie di
2) count value valoreOriginal:
replaces the contents with
count copies of value valueThe 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.
sostituisce il contenuto con le copie di quelli del
[first, last) gammaOriginal:
replaces the contents with copies of those in the range
[first, last)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.
Indice |
[modifica] Parametri
| count | - | la nuova dimensione del contenitore
Original: the new size of the container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| value | - | il valore per inizializzare elementi del contenitore
Original: the value to initialize elements of the container with The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| first, last | - | l'intervallo per copiare gli elementi da
Original: the range to copy the elements from 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.
| ||
[modifica] Complessità
1)lineare in
2) countOriginal:
linear in
countThe 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.
lineare di distanza tra
first e lastOriginal:
linear in distance between
first and lastThe 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.
[modifica] Esempio
Il codice seguente utilizza
assign per aggiungere diversi personaggi a un std::deque<char>:
Original:
The following code uses
assign to add several characters to a std::deque<char>:
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.
#include <deque> #include <iostream> int main() { std::deque<char> characters; characters.assign(5, 'a'); for (char c : characters) { std::cout << c << '\n'; } return 0; }
Output:
a a a a a
[modifica] Vedi anche
| costruisce il deque Original: constructs the deque The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |