◐ Shell
clean mode source ↗

sizeof... operator - cppreference.com

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.

Click here for the English version of this page

<metanoindex/>

Query il numero di elementi in una parametro confezione.

Original:

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

Sintassi

sizeof...( parameter_pack ) (dal C++11)

Restituisce un oggetto di tipo std::size_t.

Original:

Returns an object of type std::size_t.

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

Spiegazione

Restituisce il numero di elementi in una parametro confezione.

Original:

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

Parole chiave

sizeof

Esempio

#include <iostream>

template<class... Args>
std::size_t f()
{
    return sizeof...(Args);
}

int main()
{
    std::cout << f<>() << '\n'
              << f<int>() << '\n'
              << f<char, int, double>() << '\n';
}

Output:

Vedi anche