std::tuple_size(std::array)
Da 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. |
Definido no cabeçalho <array> | ||
template<class T, size_t N > class tuple_size< array<T, N>>: | (1) | (desde C++11) |
Permite o acesso ao número de elementos de um std::array como uma expressão constante de tempo de compilação.
Original:
Provides access to the number of elements in an std::array as a compile-time constant expression.
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.
Índice |
Herdado de std::integral_constant
Member constants
value [estática] | N , the number of elements in the array (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 <array> template<class T>void test(T t){int a[std::tuple_size<T>::value];// can be used at compile timestd::cout<< std::tuple_size<T>::value<<'\n';} int main(){std::array<float, 3> arr; test(arr);}
Saída:
3
[editar]Veja também
obtém o tamanho de tuple em tempo de compilação Original: obtains the size of tuple at compile time 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) |