Skip to content. Skip to navigation

ICTP Portal

Sections
You are here: Home Manuals on-line PGI Compiler pgC_lib pair
Personal tools
Document Actions

pair



Click on the banner to return to the class reference home page.

pair


Utility Class

Summary

A template for heterogeneous pairs of values.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <utility>

template <class T1, class T2>
struct pair ;

Description

The pair class provides a template for encapsulating pairs of values that may be of different types.

Interface

template <class T1, class T2>
 struct pair {
        T1 first;
        T2 second;
        pair();
        pair (const T1&, const T2&);
        ~pair();
};

template <class T1, class T2>
 bool operator== (const pair<T1, T2>&,
                  const pair T1, T2>&);

template <class T1, class T2>
 bool operator!= (const pair<T1, T2>&,
                  const pair T1, T2>&);

template <class T1, class T2>
 bool operator< (const pair<T1, T2>&,
                 const pair T1, T2>&);

template <class T1, class T2>
 bool operator> (const pair<T1, T2>&,
                 const pair T1, T2>&);

template <class T1, class T2>
 bool operator<= (const pair<T1, T2>&,
                 const pair T1, T2>&);

template <class T1, class T2>
 bool operator>= (const pair<T1, T2>&,
                 const pair T1, T2>&);

template <class T1, class T2>
 pair<T1,T2> make_pair (const T1&, const T2&);

Constructors and Destructors

pair ();

    Default constructor. Initializes first and second using their default constructors.

pair (const T1& x, const T2& y);

    The constructor creates a pair of types T1 and T2, making the necessary conversions in x and y.

~pair ();

    Destructor.

Non-member Operators

template <class T1, class T2>
bool 
operator== (const pair<T1, T2>& x,
                  const pair T1, T2>& y);

    Returns true if (x.first == y.first && x.second == y.second) is true. Otherwise it returns false.

template <class T1, class T2>
bool 
operator!= (const pair<T1, T2>& x,
                  const pair T1, T2>& y);

    Returns !(x==y).

template <class T1, class T2>
bool 
operator< (const pair<T1, T2>& x,
                const pair T1, T2>& y);

    Returns true if (x.first < y.first || (!(y.first < x.first) && x.second < y.second)) is true. Otherwise it returns false.

()">
template <class T1, class T2>
bool 
operator> (const pair<T1, T2>& x,
                const pair T1, T2>& y);

    Returns y < x.

template <class T1, class T2>
bool 
operator<= (const pair<T1, T2>& x,
                const pair T1, T2>& y);

    Returns !(y < x).

=()">
template <class T1, class T2>
bool 
operator>= (const pair<T1, T2>& x,
                const pair T1, T2>& y);

    Returns !(x < y).

Non-member Functions

template <class T1, class T2>
pair<T1,T2>
make_pair(x,y);

    make_pair(x,y) creates a pair by deducing and returning the types of x and y.


©Copyright 1996, Rogue Wave Software, Inc.

Weather
No information available
 

Powered by Plone This site conforms to the following standards: