Espacios de nombres
Variantes
Acciones

std::tuple_size(std::array)

De cppreference.com
< cpp‎ | container‎ | array

 
 
 
std::array
Las funciones miembro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Elemento acceso
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Los iteradores
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Capacidad
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Modificadores
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Terceros funciones
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Clases de ayuda
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tuple_size
 
Definido en la cabecera <array>
template< class T, size_t N >

class tuple_size< array<T, N> > :
    public integral_constant<size_t, N>

{ };
(1) (desde C++11)
Proporciona acceso al número de elementos en un std::array como una expresión de la constante de tiempo de compilación .
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.

Contenido

Inherited from std::integral_constant

Member constants

value
[estático]
N, the number of elements in the array
(miembro público estático constante)

Member functions

operator std::size_t
convierte el objeto a std::size_t, devuelve 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.

(función miembro público)

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] Ejemplo

#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);
}

Salida:

3

[editar] Ver también

obtiene el tamaño de tuple en tiempo de compilación
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.

(especialización de plantilla de clase) [editar]