template<class T, class U>
struct pair {
typedef T first_type;
typedef U second_type
T first;
U second;
pair();
pair(const T& x, const U& y);
template<class V, class W>
pair(const pair<V, W>& pr);
};
The template class stores a pair of objects, first
, of type T
, and second
, of type U
. The type definition first_type
is the same as the template parameter T
, while second_type
is the same as the template parameter U
.
The first (default) constructor initializes first
to T()
and second
to U()
. The second constructor initializes first
to
x
and second
to y
. The third (template) constructor initializes first
to pr.first
and second
to pr.second
. T
and
U
each need supply only a single-argument constructor and a destructor.