class template
<tuple>
std::tuple_element
| unspecialized | template <size_t I, class T> class tuple_element; |
|---|---|
| generic cv-specializations | template <size_t I, class T> class tuple_element<const T>;template <size_t I, class T> class tuple_element<volatile T>;template <size_t I, class T> class tuple_element<const volatile T>; |
| tuple specialization | template <size_t I, class... Types> class tuple_element< I, tuple<Types...> >; |
Tuple element type
It is a simple class with a single member type, tuple_element::type, defined as an alias of the type of the Ith element in a tuple of type T.
The class is itself undefined for the generic type T, but it is specialized for tuple instantiations in the <tuple> header, and for tuple-like types array and pair in their respective headers.
For const and/or volatile-qualified tuples, the class is specialized so that its type member has itself that same qualification.
Template parameters
- I
- Order number of the element within the tuple (zero-based).
This shall be lower than the actual number of elements in the tuple.
size_t is an unsigned integral type. - T
- Type for which the type of the tuple element is to be obtained.
This shall be a class for which a specialization of this class exists, such as a tuple, and tuple-like classes array and pair.
Member types
| member type | definition |
|---|---|
| type | The Ith type in the tuple object |
Example
|
|
Output:
mytuple contains: 10 and a
See also
- tuple
- Tuple (class template)
- tuple_size
- Tuple size traits (class template)