std::tuple_element<std::tuple>
From cppreference.com
Defined in header <tuple>
|
||
template< std::size_t I, class T > class tuple_element; /* undefined */ |
(1) | (since C++11) |
template< std::size_t I, class... Types > class tuple_element< I, tuple<Types...> >; |
(2) | (since C++11) |
template< std::size_t I, class T > class tuple_element< I, const T > { |
(3) | (since C++11) |
template< std::size_t I, class T > class tuple_element< I, volatile T > { |
(4) | (since C++11) |
template< size_t I, class T > class tuple_element< I, const volatile T > { |
(5) | (since C++11) |
Provides compile-type indexed access to the types of the elements of the tuple.
Contents |
[edit] Member types
Member type | Definition |
type | the type of Ith element of the tuple, where I is in [0, sizeof...(Types)) |
[edit] Possible implementation
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; }; |
[edit] Example
This section is incomplete Reason: no example |
[edit] See also
obtains the type of the elements of array (class template specialization) | |
obtains the type of the elements of pair (class template specialization) |