sizeof... operator
De cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Interroge le nombre d'éléments dans un Paquet de paramètre .
Original:
Queries the number of elements in a Paquet de paramètre.
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.
Sommaire |
[modifier] Syntaxe
sizeof...( parameter_pack )
|
(depuis C++11) | ||||||||
Retourne un objet de type .. 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.
You can help to correct and verify the translation. Click here for instructions.
[modifier] Explication
Retourne le nombre d'éléments dans un Paquet de paramètre .
Original:
Returns the number of elements in a Paquet de paramètre.
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.
[modifier] Mots-clés
[modifier] Exemple
#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'; }
Résultat :
0 1 3