std::deque::push_back
De 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. |
<metanoindex/>
<tbody> </tbody> void push_back( const T& value ); |
||
void push_back( T&& value ); |
(depuis C++11) | |
Ajoute le
value élément donné de l'extrémité du récipient . Original:
Appends the given element
value to the end 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.
All iterators are invalidated. No references are invalidated.
Paramètres
| value | - | la valeur de l'élément à ajouter
Original: the value of the element to append The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Exigences
1)
value est CopyInsertableOriginal:
value shall be CopyInsertableThe 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.
2)
value est MoveInsertableOriginal:
value shall be MoveInsertableThe 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.
Retourne la valeur
(Aucun)
Original:
(none)
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.
Complexité
Constant .
Original:
Constant.
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.
Exemple
Le code suivant utilise
push_back d'ajouter plusieurs entiers à un std::deque<int>:
Original:
The following code uses
push_back to add several integers to a std::deque<int>:
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<int> numbers;
numbers.push_back(42);
numbers.push_back(314159);
for (int i : numbers) { // c++11 range-based for loop
std::cout << i << '\n';
}
return 0;
}
Résultat :
42
314159
Voir aussi
(C++11) |
construit des éléments en place à la fin (fonction membre publique) |
| insère des éléments au début (fonction membre publique) | |
supprime le dernier élément Original: removes the last element The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |