std::unordered_map::size - cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
|
|
(desde C++11) | |
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Parâmetros
(Nenhum)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Valor de retorno
o número de elementos no recipiente
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.
Exceções
Complexidade
Constant
Exemplo
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"; }
Saída:
nums contains 4 elements.
Veja também
verifica se o recipiente estiver vazio Original: checks whether the container is empty The text has been machine-translated via Google Translate. (função pública membro) [edit] | |
retorna o número máximo possível de elementos Original: returns the maximum possible number of elements The text has been machine-translated via Google Translate. (função pública membro) [edit] | |