std::map::operator[] – cppreference.com
Aus cppreference.com
<metanoindex/>
<tbody> </tbody>
|
|
(1) | |
|
|
(2) | (seit C++11) |
Fügt ein neues Element in den Behälter mit key als Schlüssel und Standard gebaut mapped Wert und gibt einen Verweis auf das neu errichtete kartiert Wert. Wenn ein Element mit Schlüssel key bereits existiert, wird keine Insertion durchgeführt und ein Verweis auf seine kartiert Wert zurückgegeben .
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.
1)
Führt im wesentlichen (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.
2)
Führt im wesentlichen (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.
No iterators or references are invalidated.
Parameter
| key | - | der Schlüssel des Elements zu finden Original: the key of the element to find The text has been machine-translated via Google Translate. |
Rückgabewert
Bezugnahme auf den zugeordneten Wert des neuen Elements, wenn kein Element mit Schlüssel key existierte. Andernfalls wird ein Verweis auf das zugeordnete Wert der bestehenden Element zurückgegeben .
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.
Komplexität
Logarithmic in the size of the container.
Beispiel
Siehe auch
Zugriff auf angegebene Element mit Überprüfung von Grenzen Original: access specified element with bounds checking The text has been machine-translated via Google Translate. (öffentliche Elementfunktion) [edit] | |