pair( const T1 &a, const T2 &b );

The pair struct is a way to store two pieces of heterogeneous data.

These data may be accessed using the first and second fields of a pair.

Pairs may be tested for equality with the == operator. The < operator is also defined for pairs; given two pairs x and y, the < operator returns:

x.first < y.first || ((y.first == x.first) && x.second < y.second)

The make_pair function can be used as a shortcut when creating pairs to avoid explicitly specifying the types for the two pieces of data.

Related: make_pair