◐ Shell
clean mode source ↗

std::tuple_size(std::array) - cppreference.com

Da cppreference.com.

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.

Click here for the English version of this page

<metanoindex/>

<tbody> </tbody>

Elemento definito nell'header

<array>

template< class T, size_t N > class tuple_size< array<T, N> > : public integral_constant<size_t, N> { };

(1) (dal C++11)

Consente di accedere al numero di elementi in un std::array come un tempo di compilazione espressione costante.

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.

Inherited from std::integral_constant

Member constants

N, the number of elements in the array
(pubblico membro statico costante)

Member functions

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>

Esempio

#include <iostream>
#include <array>

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';
}

int main()
{
    std::array<float, 3> arr;
    test(arr);
}

Output:

Vedi anche

ottiene la dimensione della tuple al momento della compilazione

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.


(classe modello di specializzazione) [modifica]