Espacios de nombres
Variantes
Acciones

std::tuple_size<std::pair>

De cppreference.com
< cpp‎ | utility‎ | pair
 
 
Utilidades de la biblioteca
Escriba apoyo (basic types, RTTI, type traits)
Gestión de memoria dinámica
Gestión de errores
Programa de servicios públicos
Funciones variadic
Fecha y hora
Objetos Function
(C++11)
Operadores relacionales
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Pares y tuplas
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
Cambiar, hacia adelante y mover
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
 
std::pair
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.
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.
(C++11)
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
(C++11)
 
Definido en la cabecera <utility>
template< class T1, class T2 >
struct tuple_size<std::pair<T1, T2>>;
(desde C++11)

The partial specialization of std::tuple_size for pairs provides a compile-time way to obtain the number of elements in a pair, which is always 2, using tuple-like syntax.

Members

value
[estático]
integral constant with value 2
(miembro público estático constante)

[editar] Ejemplo

#include <iostream>
#include <utility>
#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));
    test(std::make_pair(1, 3.14));
}

Salida:

3
2

[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]
obtiene el tamaño de 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.

(especialización de plantilla de clase) [editar]
se obtiene el tipo de los elementos de pair
Original:
obtains the type of the elements of pair
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]