std::tuple_element<std::tuple>

From Cppreference

Jump to: navigation, search
Defined in header <tuple>

template< std::size_t I, class T >
class tuple_element; /* undefined */
(1) (C++11 feature)
template< std::size_t I, class... Types >
class tuple_element< I, tuple<Types...> >;
(2) (C++11 feature)
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) (C++11 feature)
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) (C++11 feature)
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) (C++11 feature)

Provides compile-type indexed access to the types of the elements of the tuple.

[edit] Member types

Member type Definition
type the type of Ith element of the tuple, where I is in [0, sizeof...(Types))

[edit] Equivalent definition

[edit] Example