std::tuple_size<std::tuple>
![]() |
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. |
Elemento definito nell'header <tuple>
|
||
template< class T > class tuple_size; /*undefined*/ |
(1) | (dal C++11) |
template< class... Types > class tuple_size<tuple<Types...> > |
(2) | (dal C++11) |
template< class T > class tuple_size<const T> |
(3) | (dal C++11) |
template< class T > class tuple_size< volatile T > |
(4) | (dal C++11) |
template< class T > class tuple_size< const volatile T > |
(5) | (dal C++11) |
You can help to correct and verify the translation. Click here for instructions.
Indice |
Inherited from std::integral_constant
Member constants
value [statico] |
sizeof...(Types) (pubblico membro statico costante) |
Member functions
operator std::size_t |
converte l'oggetto in std::size_t, restituisce value Original: converts the object to std::size_t, returns value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) |
Member types
Tipo
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
value_type
|
std::size_t
|
type
|
std::integral_constant<std::size_t, value> |
[modifica] Esempio
#include <iostream> #include <tuple> template<class T> void test(T t) { int a[std::tuple_size<T>::value]; // can be used at compile time std::cout << std::tuple_size<T>::value << '\n'; // or at run time } int main() { test(std::make_tuple(1, 2, 3.14)); }
Output:
3
[modifica] Vedi anche
ottiene la dimensione di un array Original: obtains the size of an array The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe modello di specializzazione) | |
(C++11) |
ottiene la dimensione di un pair Original: obtains the size of a pair The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe modello di specializzazione) |
tupla accede elemento specificato Original: tuple accesses specified element The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione di modello) | |
ottiene il tipo dell'elemento specificato Original: obtains the type of the specified element The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe modello di specializzazione) |