std::get(std::tuple)
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. |
template<std::size_t I, class... Types> typename std::tuple_element<I, tuple<Types...>>::type& | (1) | (dal C++11) |
template<std::size_t I, class... Types> typename std::tuple_element<I, tuple<Types...>>::type&& | (2) | (dal C++11) |
template<std::size_t I, class... Types> typename std::tuple_element<I, tuple<Types...>>::typeconst& | (3) | (dal C++11) |
Estrae l'elemento
Ith
elemento della tupla. I
è un valore intero in [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.
Indice |
[modifica]Parametri
t | - | tupla il cui contenuto da estrarre 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. |
[modifica]Valore di ritorno
1)Riferimento all'elemento
2) Ith
di 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 riferimento all'elemento di
3) Ith
t
, a meno che l'elemento è di tipo lvalue riferimento, nel qual caso viene restituito lvalue riferimento.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 riferimento all'elemento
Ith
di 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.
[modifica]Eccezioni
[modifica]Esempio
#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";}
Output:
(1, Foo, 3.14)
[modifica]Vedi anche
accesses an element of an array (funzione di modello) | |
(C++11) | accede a un elemento di una pair Original: accesses an element of a pair The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione di modello) |