std::tuple_size<std::tuple>
![]() |
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. |
Definido no cabeçalho <tuple>
|
||
template< class T > class tuple_size; /*undefined*/ |
(1) | (desde C++11) |
template< class... Types > class tuple_size<tuple<Types...> > |
(2) | (desde C++11) |
template< class T > class tuple_size<const T> |
(3) | (desde C++11) |
template< class T > class tuple_size< volatile T > |
(4) | (desde C++11) |
template< class T > class tuple_size< const volatile T > |
(5) | (desde C++11) |
You can help to correct and verify the translation. Click here for instructions.
Índice |
Herdado de std::integral_constant
Member constants
value [estática] |
sizeof...(Types) (membro estático público constante) |
Member functions
operator std::size_t |
converte o objeto em std::size_t, retorna 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. (função pública membro) |
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> |
[editar] Exemplo
#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)); }
Saída:
3
[editar] Veja também
obtém o tamanho de um 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. (especialização modelo. classe) | |
(C++11) |
obtém o tamanho de um 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. (especialização modelo. classe) |
tupla acessa elemento especificado 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. (modelo de função) | |
obtém o tipo do elemento especificado 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. (especialização modelo. classe) |