.\" ident @(#)pair.3 .\" Standard Template Library .\" $$RW_INSERT_HEADER "slyrs.man" .TH pair 3C++ "02 Apr 1998" "Rogue Wave Software" "-" .ce2 Standard C++ Library Copyright 1998, Rogue Wave Software, Inc. .SH NAME \f2pair\fP \ - A template for heterogeneous pairs of values. .SH SYNOPSIS .br #include .br template .br struct pair ; .SH DESCRIPTION The pair class is a template for encapsulating pairs of values that may be of different types. .SH INTERFACE .br template .br struct pair { .RE .RS 7 typedef T1 first_type; .br typedef T2 second_type; .br T1 first; .br T2 second; .br pair(); .br pair (const T1&, const T2&); .br template .br pair (const pair & p); .RE .RS 8 ~pair(); .RE .RS 0 }; .br .br template .br bool operator== (const pair&, .RE .RS 17 const pair T1, T2>&); .RE .RS 0 .br template .br bool operator!= (const pair&, .RE .RS 17 const pair T1, T2>&); .RE .RS 0 .br template .br bool operator< (const pair&, .RE .RS 16 const pair T1, T2>&); .RE .RS 0 .br template .br bool operator> (const pair&, .RE .RS 16 const pair T1, T2>&); .RE .RS 0 .br template .br bool operator<= (const pair&, .RE .RS 16 const pair T1, T2>&); .RE .RS 0 .br template .br bool operator>= (const pair&, .RE .RS 16 const pair T1, T2>&); .RE .RS 0 .br template .br pair make_pair (const T1&, const T2&); .SH TYPES .br first_type .RE .RS 3 Type of the first element in a pair. .RE .br second_type .RE .RS 3 Type of the second element in a pair. .RE .SH CONSTRUCTORS .br pair (); .RE .RS 3 Default constructor. Initializes \f2first\fP and \f2second\fP using their default constructors. .RE .br pair (const T1& x, const T2& y); .RE .RS 3 Creates a pair of types \f2T1\fP and \f2T2\fP, making the necessary conversions in\f2 x\fP and \f2y\fP. .RE .br template .br pair (const pair & p); .RE .RS 3 Copies \f2first\fP and \f2second\fP from the corresponding elements of \f2p\fP. .RE .SH DESTRUCTORS .br ~pair (); .SH NON-MEMBER OPERATORS .br template .br bool operator== (const pair& x, .RE .RS 17 const pair T1, T2>& y); .RE .RS 3 Returns \f2true\fP if \f2(x.first == y.first && x.second == y.second\fP) is \f2true\fP. Otherwise it returns \f2false\fP. .RE .RE .RS 0 template .br bool operator!= (const pair& x, .RE .RS 17 const pair T1, T2>& y); .RE .RS 3 Returns \f2!(x==y)\fP. .RE .RE .RS 0 template .br bool operator< (const pair& x, .RE .RS 15 const pair T1, T2>& y); .RE .RS 3 Returns \f2true\fP if \f2(x.first < y.first || (!(y.first < x.first) && x.second < y.second))\fP is \f2true\fP. Otherwise it returns \f2false\fP. .RE .RE .RS 0 template .br bool operator> (const pair& x, .RE .RS 15 const pair T1, T2>& y); .RE .RS 3 Returns \f2y < x\fP. .RE .RE .RS 0 template .br bool operator<= (const pair& x, .RE .RS 15 const pair T1, T2>& y); .RE .RS 3 Returns \f2!(y < x)\fP. .RE .RE .RS 0 template .br bool operator>= (const pair& x, .RE .RS 15 const pair T1, T2>& y); .RE .RS 3 Returns \f2!(x < y)\fP. .RE .SH NON-MEMBER FUNCTIONS .RE .RS 0 template .br pair .br make_pair(x,y); .RE .RS 3 \f2make_pair(x,y)\fP creates a pair by deducing and returning the types of \f2x\fP and \f2y\fP. .RE