Espacios de nombres
Variantes
Acciones

std::unordered_map::size

De cppreference.com

 
 
 
std::unordered_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.
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.
unordered_map::size
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.
Bucket interfaz
Original:
Bucket interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Política Hash
Original:
Hash policy
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.
 
size_type size() const;
(desde C++11)

Returns the number of elements in the container, i.e. std::distance(begin(), end()).

Contenido

[editar] Parámetros

(Ninguno)
Original:
(none)
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

el número de elementos en el contenedor
Original:
the number of elements in the container
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Excepciones

noexcept specification:  
noexcept
  (desde C++11)

[editar] Complejidad

Constant

[editar] Ejemplo

The following code uses size to display the number of elements in a std::unordered_map<int>:

#include <unordered_map>
#include <iostream>
 
int main()
{
    std::unordered_map<int, char> nums {{1, 'a'}, {3, 'b'}, {5, 'c'}, {7, 'd'}};
 
    std::cout << "nums contains " << nums.size() << " elements.\n";
}

Salida:

nums contains 4 elements.

[editar] Ver también

comprueba si el recipiente está vacío
Original:
checks whether the container is empty
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]
devuelve el número máximo posible de elementos
Original:
returns the maximum possible number of elements
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]