Espacios de nombres
Variantes
Acciones

std::map::operator[]

De cppreference.com
< cpp‎ | container‎ | map

 
 
 
std::map
Las funciones miembro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Elemento acceso
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
map::operator[]
Los iteradores
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Capacidad
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Modificadores
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Buscar
Original:
Lookup
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Los observadores
Original:
Observers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
T& operator[]( const Key& key );
(1)
T& operator[]( Key&& key );
(2) (desde C++11)
Inserta un nuevo elemento en el contenedor utilizando key como la clave y el valor por defecto asignado construido y devuelve una referencia al valor de nueva construcción asignada. Si un elemento con key clave ya existe, no se lleva a cabo la inserción y una referencia a su valor asignado se devuelve .
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)
Esencialmente realiza (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)
Esencialmente realiza (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.

Contenido

[editar] Parámetros

key -
la clave del elemento de encontrar
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.

[editar] Valor de retorno

La referencia al valor asignado del nuevo elemento si no hay ningún elemento con key clave existido. De lo contrario una referencia al valor mapeado del elemento existente se devuelve .
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.

[editar] Complejidad

Logarithmic in the size of the container.

[editar] Ejemplo

[editar] Ver también

(C++11)
acceder al elemento especificado con comprobación de límites
Original:
access specified element with bounds checking
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro público) [editar]