sizeof... operator
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
Pregunta el número de elementos en un parámetro de paquete .
Original:
Queries the number of elements in a parámetro de paquete.
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.
Contenido |
[editar] Sintaxis
sizeof...( parameter_pack )
|
(desde C++11) | ||||||||
Devuelve un objeto de 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.
You can help to correct and verify the translation. Click here for instructions.
[editar] Explicación
Devuelve el número de elementos en un parámetro de paquete .
Original:
Returns the number of elements in a parámetro de paquete.
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.
[editar] Palabras clave
[editar] Ejemplo
Ejecuta este código
#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'; }
Salida:
0 1 3

