std::get(std::tuple)
Aus cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody> template< std::size_t I, class... Types > typename std::tuple_element<I, tuple<Types...> >::type& get( tuple<Types...>& t ); |
(1) | (seit C++11) |
template< std::size_t I, class... Types > typename std::tuple_element<I, tuple<Types...> >::type&& get( tuple<Types...>&& t ); |
(2) | (seit C++11) |
template< std::size_t I, class... Types > typename std::tuple_element<I, tuple<Types...> >::type const& get( const tuple<Types...>& t ); |
(3) | (seit C++11) |
Extrahiert die
Ith element aus dem Tupel. I ist ein Integer-Wert 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.
Parameter
| t | - | Tupel, dessen Inhalt zu extrahieren
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. |
Rückgabewert
1)
Verweis auf die
Ith Element 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.
2)
Rvalue Verweis auf das Element
Ith t, sofern das Element der L-Wert-Referenz-Typ, wobei in diesem Fall L-Wert Verweis zurückgegeben .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.
3)
Const Verweis auf die
Ith Element 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.
Ausnahmen
Beispiel
#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)
Siehe auch
accesses an element of an array (Funktions-Template) | |
(C++11) |
greift ein Element eines 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. (Funktions-Template) |