Espaces de noms
Variantes
Affichages
Actions

std::unordered_map::size

De cppreference.com

 
 
 
std::unordered_map
Les fonctions membres
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.
unordered_map::unordered_map
unordered_map::~unordered_map
unordered_map::operator=
unordered_map::get_allocator
Les itérateurs
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
unordered_map::begin
unordered_map::cbegin
unordered_map::end
unordered_map::cend
Capacité
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::erase
unordered_map::size
unordered_map::max_size
Modificateurs
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
unordered_map::clear
unordered_map::insert
unordered_map::emplace
unordered_map::emplace_hint
unordered_map::erase
unordered_map::swap
Lookup
Original:
Lookup
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
unordered_map::count
unordered_map::find
unordered_map::equal_range
Interface seau
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.
unordered_map::begin2
unordered_map::end2
unordered_map::bucket_count
unordered_map::max_bucket_count
unordered_map::bucket_size
unordered_map::bucket
Politique de hachage
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.
unordered_map::load_factor
unordered_map::max_load_factor
unordered_map::rehash
unordered_map::reserve
Des observateurs
Original:
Observers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
unordered_map::hash_function
unordered_map::key_eq
 
size_type size() const;
(depuis C++11)

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

Sommaire

[modifier] Paramètres

(Aucun)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Retourne la valeur

le nombre d'éléments dans le conteneur
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.

[modifier] Exceptions

noexcept specification:  
noexcept
   (depuis C++11)

[modifier] Complexité

Constant

[modifier] Exemple

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";
}

Résultat :

nums contains 4 elements.

[modifier] Voir aussi

vérifie si le conteneur est vide
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.

(fonction membre publique) [edit]
retourne le plus grand nombre possible d'éléments
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.

(fonction membre publique) [edit]