class template specialization
<utility>

std::tuple_element<pair>

unspecialized
template <size_t I, class Tpl> class tuple_element;
access first
template <class T1, class T2>  struct tuple_element <0, pair<T1,T2>>;
access second
template <class T1, class T2>  struct tuple_element <1, pair<T1,T2>>;
Tuple element type for pair
Accesses the static type of the members of a pair object as if it was a tuple.

These class specializations simply provide a member called type, which aliases either T1 or T2, as if defined as:
1
2
3
4
5
6
7
template <size_t I, class Tpl> class tuple_element;

template <class T1, class T2> struct tuple_element <0, pair<T1,T2>>
{ typedef T1 type; };

template <class T1, class T2> struct tuple_element <1, pair<T1,T2>>
{ typedef T2 type; };

See tuple_element for more information.

Template parameters

I
Order number of the element within the pair (zero-based).
This is 0 to access the type of member first and 1 to access the type of member second.
If instantiated with any other values, the program is ill-formed.
size_t is an unsigned integral type.
Tpl
Tuple-like type. For these specializations: pair<T1,T2>.
T1, T2
Type of the elements in the pair.
Aliased as member type.

Member types

member typedefinition
typeT1 if I is 0, or T2 id I is 1.

See also