Espaces de noms
Variantes
Affichages
Actions

std::get(std::tuple)

De cppreference.com
< cpp‎ | utility‎ | tuple

 
 
 
std::tuple
Les fonctions membres
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.
tuple::tuple
tuple::operator=
tuple::swap
Tiers fonctions
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.
make_tuple
tie
forward_as_tuple
None
operator=
operator!=
operator<
operator<=
operator>
operator>=
std::swap
get
Classes d'aide
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
tuple_element
uses_allocator
ignore
 
template< std::size_t I, class... Types >

typename std::tuple_element<I, tuple<Types...> >::type&

    get( tuple<Types...>& t );
(1) (depuis C++11)
template< std::size_t I, class... Types >

typename std::tuple_element<I, tuple<Types...> >::type&&

    get( tuple<Types...>&& t );
(2) (depuis C++11)
template< std::size_t I, class... Types >

typename std::tuple_element<I, tuple<Types...> >::type const&

    get( const tuple<Types...>& t );
(3) (depuis C++11)
Extraits de l'élément element Ith du tuple. I est une valeur entière dans [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.

Sommaire

[modifier] Paramètres

t -
tuple dont le contenu à extraire
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.

[modifier] Retourne la valeur

1)
Référence à l'élément de Ith 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.
2)
Rvalue référence à l'élément de Ith t, sauf si l'élément est de type référence lvalue, auquel cas lvalue référence est renvoyé .
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.
3)
Référence const à l'élément 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.

[modifier] Exceptions

noexcept specification:  
noexcept
   (depuis C++11)

[modifier] Exemple

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

Résultat :

(1, Foo, 3.14)

[modifier] Voir aussi

accesses an element of an array
(fonction générique) [edit]
accède à un élément d'un 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.

(fonction générique) [edit]