pair


An object that contains two other objects. It is most commonly used for conveniently storing and passing pairs of objects.

Library

Standards<ToolKit>

Declaration


#include <utility>

template< class T1, class T2 >
struct pair

Adaptor

pair< T1, T2 >
make_pair( const T1& x, const T2& y );

Interface

Constructor
pair()
Constructs a pair that contains default instances of T1 and T2 .
Constructor
pair( const T1& a , const T2& b )
Constructs a pair that contains a copy of a as the first item and a copy of b as the second item.
first
first
The pair's first item. This is a public data member, not a function.
second
second
The pair's second item. This is a public data member, not a function.

Non-Member Functions

==
bool operator==( const pair< T1, T2 >& x , const pair< T1, T2 >& y )
Returns true if ( x . first == y . first ) and ( x . second == y . second ). This is a templatized non-member function.
<
bool operator<( const pair< T1, T2 >& x , const pair< T1, T2 >& y )
Returns true if x is lexicographically less than y . That is, ( x . first < y . first ) or ( x . first == y . first >& x . second < y . second ). This is a templatized non-member function.

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.