std::unordered_set::size
Da cppreference.com.
< cpp | container | unordered set
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
size_type size() const; |
(dal C++11) | |
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Indice |
[modifica] Parametri
(Nessuno)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Valore di ritorno
il numero di elementi nel contenitore
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.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Eccezioni
[modifica] Complessità
Constant
[modifica] Esempio
The following code uses size
to display the number of elements in a std::unordered_set<int>:
#include <unordered_set> #include <iostream> int main() { std::unordered_set<int> nums {1, 3, 5, 7}; std::cout << "nums contains " << nums.size() << " elements.\n"; }
Output:
nums contains 4 elements.
[modifica] Vedi anche
verifica se il contenitore è vuoto 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. (metodo pubblico) | |
restituisce il massimo numero possibile di elementi 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. (metodo pubblico) |