std::array::size
Da cppreference.com.
![]() | 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. |
constexpr size_type size() | (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::array<int>:
#include <array>#include <iostream> int main(){std::array<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) |