Espaces de noms
Variantes
Affichages
Actions

std::map::size

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

 
 
 
std::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.
map::map
map::~map
map::operator=
map::get_allocator
Elément d'accès
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::at
map::operator[]
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.
map::begin
map::cbegin

(C++11)
map::end
map::cend

(C++11)
map::rbegin
map::crbegin

(C++11)
map::rend
map::crend

(C++11)
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.
map::empty
map::size
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.
map::clear
map::insert
map::emplace (C++11)
map::emplace_hint (C++11)
map::erase
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.
map::count
map::find
map::equal_range
map::lower_bound
map::upper_bound
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.
map::key_comp
map::value_comp
 
size_type size() const;

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::map<int>:

#include <map>
#include <iostream>
 
int main()
{
    std::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]