Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members

# util::Pair< T, U > Class Template Reference

`#include <Pair.h>`

Inheritance diagram for util::Pair< T, U >:

List of all members.

## Detailed Description

### template<class T, class U> class util::Pair< T, U >

Pair is a utility class for storing pairs of objects.

For example, Hashtable uses Pair to store key-value pairs.

## Public Methods

Pair ()
The default constructor.

Pair (const T &obj1, const U &obj2)
Create a pair of objects.

Pair (const Pair &other)
Copy an object pair.

Pair & operator= (const Pair &other)
Copy the contents of another pair.

getFirst (void) const
Get the first element in the pair.

T & first (void)
Get the first element in the pair.

const T & first (void) const
Get the first element in the pair.

void setFirst (const T &obj)
Set the first element in the pair.

getSecond (void) const
Get the second element in the pair.

U & second (void)
Get the second element in the pair.

const U & second (void) const
Get the second element in the pair.

void setSecond (const U &obj)
Set the second element in the pair.

Pair & operator *= (const Pair &other)
Multiply two pairs.

Pair & operator/= (const Pair &other)
Divide two pairs.

Pair & operator+= (const Pair &other)

Pair & operator-= (const Pair &other)
Subtract two pairs.

Pair & operator *= (T value)
Multiply pair and value.

Pair & operator/= (T value)
Dividing pair and value.

Pair & operator+= (T value)
Adding pair and value.

Pair & operator-= (T value)
Subtract pair and value.

## Friends

template<class V, class X> bool operator== (const Pair< V, X > &p1, const Pair< V, X > &p2)
Compare two pairs.

template<class V, class X> bool operator!= (const Pair< V, X > &p1, const Pair< V, X > &p2)
Compare two pairs.

template<class V, class X> bool operator< (const Pair< V, X > &p1, const Pair< V, X > &p2)
Compare two pairs.

template<class V, class X> bool operator> (const Pair< V, X > &p1, const Pair< V, X > &p2)
Compare two pairs.

template<class V, class X> bool operator<= (const Pair< V, X > &p1, const Pair< V, X > &p2)
Compare two pairs.

template<class V, class X> bool operator>= (const Pair< V, X > &p1, const Pair< V, X > &p2)
Compare two pairs.

template<class V, class X> Pair< V, X > operator * (const Pair< V, X > &p1, const Pair< V, X > &p2)
template<class V, class X> Pair< V, X > operator/ (const Pair< V, X > &p1, const Pair< V, X > &p2)
template<class V, class X> Pair< V, X > operator+ (const Pair< V, X > &p1, const Pair< V, X > &p2)
template<class V, class X> Pair< V, X > operator- (const Pair< V, X > &p1, const Pair< V, X > &p2)
template<class V, class X> Pair< V, X > operator * (const Pair< V, X > &p1, V value)
template<class V, class X> Pair< V, X > operator/ (const Pair< V, X > &p1, V value)
template<class V, class X> Pair< V, X > operator+ (const Pair< V, X > &p1, V value)
template<class V, class X> Pair< V, X > operator- (const Pair< V, X > &p1, V value)

## Constructor & Destructor Documentation

 template util::Pair< T, U >::Pair ( ) ` [inline]`
 The default constructor. Primitive type elements are uninitialized, and complex type elements are initialized using their default constructor.

## Member Function Documentation

 template Pair& util::Pair< T, U >::operator *= ( T value ) ` [inline]`
 Multiply pair and value. The multiplying of pair and value is defined by the first element of pair and the value.

 template Pair& util::Pair< T, U >::operator *= ( const Pair< T, U > & other ) ` [inline]`
 Multiply two pairs. The multiplying of two pairs is defined by their first elements.

 template Pair& util::Pair< T, U >::operator+= ( T value ) ` [inline]`
 Adding pair and value. The adding of pair and value is defined by the first element of pair and the value.

 template Pair& util::Pair< T, U >::operator+= ( const Pair< T, U > & other ) ` [inline]`
 Adding two pairs. The adding of two pairs is defined by their first elements.

 template Pair& util::Pair< T, U >::operator-= ( T value ) ` [inline]`
 Subtract pair and value. The subtracting of pair and value is defined by the first element of pair and the value.

 template Pair& util::Pair< T, U >::operator-= ( const Pair< T, U > & other ) ` [inline]`
 Subtract two pairs. The subtracting of two pairs is defined by their first elements.

 template Pair& util::Pair< T, U >::operator/= ( T value ) ` [inline]`
 Dividing pair and value. The dividing of pair and value is defined by the first element of pair and the value.

 template Pair& util::Pair< T, U >::operator/= ( const Pair< T, U > & other ) ` [inline]`
 Divide two pairs. The dividing of two pairs is defined by their first elements.

## Friends And Related Function Documentation

 template template bool operator!= ( const Pair< V, X > & p1, const Pair< V, X > & p2 ) ` [friend]`
 Compare two pairs. Pairs are different if either of their elements are different.

 template template bool operator< ( const Pair< V, X > & p1, const Pair< V, X > & p2 ) ` [friend]`
 Compare two pairs. The relative order of two pairs is defined by their first elements.

 template template bool operator<= ( const Pair< V, X > & p1, const Pair< V, X > & p2 ) ` [friend]`
 Compare two pairs. The relative order of two pairs is defined by their first elements.

 template template bool operator== ( const Pair< V, X > & p1, const Pair< V, X > & p2 ) ` [friend]`
 Compare two pairs. Pairs are equal if both of their elements are equal.

 template template bool operator> ( const Pair< V, X > & p1, const Pair< V, X > & p2 ) ` [friend]`
 Compare two pairs. The relative order of two pairs is defined by their first elements.

 template template bool operator>= ( const Pair< V, X > & p1, const Pair< V, X > & p2 ) ` [friend]`
 Compare two pairs. The relative order of two pairs is defined by their first elements.

The documentation for this class was generated from the following file:
• Pair.h

Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.