std::get(std::tuple)
De cppreference.com
![]() | Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate. La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
template<std::size_t I, class... Types> typenamestd::tuple_element<I, tuple<Types...>>::type& | (1) | (desde C++11) |
template<std::size_t I, class... Types> typenamestd::tuple_element<I, tuple<Types...>>::type&& | (2) | (desde C++11) |
template<std::size_t I, class... Types> typenamestd::tuple_element<I, tuple<Types...>>::typeconst& | (3) | (desde C++11) |
Extrae el elemento
Ith
elemento de la tupla. I
es un valor entero en [0, sizeof...(Types))
.Original:
Extracts the
Ith
element element from the tuple. I
is an integer value in [0, sizeof...(Types))
.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.
Contenido |
[editar]Parámetros
t | - | tupla cuyo contenido desea extraer Original: tuple whose contents to extract The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[editar]Valor de retorno
1)Referencia al elemento
2) Ith
de t
.Original:
Reference to the
Ith
element of t
.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.
Rvalue referencia al elemento de
3) Ith
t
, a menos que el elemento sea de valor-i tipo de referencia, en cuyo caso se devuelve lvalue referencia .Original:
Rvalue reference to the
Ith
element of t
, unless the element is of lvalue reference type, in which case lvalue reference is returned.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.
Const referencia al elemento de
Ith
t
.Original:
Const reference to the
Ith
element of t
.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.
[editar]Excepciones
[editar]Ejemplo
Ejecuta este código
#include <iostream>#include <string>#include <tuple> int main(){auto t =std::make_tuple(1, "Foo", 3.14);std::cout<<"("<<std::get<0>(t)<<", "<<std::get<1>(t)<<", "<<std::get<2>(t)<<")\n";}
Salida:
(1, Foo, 3.14)
[editar]Ver también
(C++11) | Accede a un elemento de un array . (plantilla de función) |
(C++11) | accede a un elemento de un par. (plantilla de función) |