std::map::operator[]
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/>
|
|
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> T& operator[]( const Key& key ); |
(1) | |
T& operator[]( Key&& key ); |
(2) | (depuis C++11) |
Insère un nouvel élément dans le récipient à l'aide
key comme la clé par défaut et la valeur construite mappé et renvoie une référence à la valeur nouvellement construit mappé. Si un élément de key clé existe déjà, aucune insertion est effectuée et une référence à sa valeur mappée est retourné .Original:
Inserts a new element to the container using
key as the key and default constructed mapped value and returns a reference to the newly constructed mapped value. If an element with key key already exists, no insertion is performed and a reference to its mapped value is returned.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.
1)
Effectue essentiellement
(insert(std::make_pair(key, T())).first)->second .Original:
Essentially performs
(insert(std::make_pair(key, T())).first)->second.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.
2)
Effectue essentiellement
(insert(std::make_pair(std::move(key), T())).first)->second .Original:
Essentially performs
(insert(std::make_pair(std::move(key), T())).first)->second.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.
No iterators or references are invalidated.
Paramètres
| key | - | la clé de l'élément à trouver
Original: the key of the element to find The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Retourne la valeur
Référence à la valeur de l'élément mappé nouveau si aucun élément avec la clé
key existé. Sinon une référence à la valeur associée de l'élément actuel est retourné .Original:
Reference to the mapped value of the new element if no element with key
key existed. Otherwise a reference to the mapped value of the existing element is returned.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é
Logarithmic in the size of the container.
Exemple
| This section is incomplete Reason: no example |
Voir aussi
(C++11) |
accède à l'élément spécifié avec vérification de bornes (fonction membre publique) |