Espaces de noms
Variantes

std::tuple_element<std::tuple>

De cppreference.com

<metanoindex/>

 
 
 
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
 
<tbody> </tbody>
Déclaré dans l'en-tête <tuple>
template< std::size_t I, class T > class tuple_element; /* undefined */
(1) (depuis C++11)
template< std::size_t I, class... Types > class tuple_element< I, tuple<Types...> >;
(2) (depuis C++11)
template< std::size_t I, class T > class tuple_element< I, const T > { typedef typename std::add_const<typename std::tuple_element<I, T>::type>::type type; };
(3) (depuis C++11)
template< std::size_t I, class T > class tuple_element< I, volatile T > { typedef typename std::add_volatile<typename std::tuple_element<I, T>::type>::type type; };
(4) (depuis C++11)
template< size_t I, class T > class tuple_element< I, const volatile T > { typedef typename std::add_cv<typename std::tuple_element<I, T>::type>::type type; };
(5) (depuis C++11)
Fournit la compilation type d'accès indexé à des types d'éléments du tuple .
Original:
Provides compile-type indexed access to the types of the elements of the tuple.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Types de membres

Type du membre Définition
type
le type d'élément Ith du tuple, où I est en [0, sizeof...(Types))
Original:
the type of Ith element of the tuple, where I is 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.

Mise en œuvre possible

template< std::size_t I, class T >
struct tuple_element;

// recursive case
template<std::size_t I, class Head, class... Tail >
struct tuple_element<I, std::tuple<Head, Tail...>>
    : std::tuple_element<I-1, std::tuple<Tail...>> { };

// base case
template< class Head, class... Tail >
struct tuple_element<0, std::tuple<Head, Tail...>> {
   typedef Head type;
};

Exemple

Voir aussi

obtient le type des éléments de array
Original:
obtains the type of the elements of array
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe générique spécialisée) [edit]
obtient le type des éléments 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.

(classe générique spécialisée) [edit]