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 >:

util::Object 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)
 Adding two pairs.

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<class T, class U>
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<class T, class U>
Pair& util::Pair< T, U >::operator *=   value [inline]
 

Multiply pair and value.

The multiplying of pair and value is defined by the first element of pair and the value.

template<class T, class U>
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<class T, class U>
Pair& util::Pair< T, U >::operator+=   value [inline]
 

Adding pair and value.

The adding of pair and value is defined by the first element of pair and the value.

template<class T, class U>
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<class T, class U>
Pair& util::Pair< T, U >::operator-=   value [inline]
 

Subtract pair and value.

The subtracting of pair and value is defined by the first element of pair and the value.

template<class T, class U>
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<class T, class U>
Pair& util::Pair< T, U >::operator/=   value [inline]
 

Dividing pair and value.

The dividing of pair and value is defined by the first element of pair and the value.

template<class T, class U>
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<class T, class U>
template<class V, class X>
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<class T, class U>
template<class V, class X>
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<class T, class U>
template<class V, class X>
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<class T, class U>
template<class V, class X>
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<class T, class U>
template<class V, class X>
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<class T, class U>
template<class V, class X>
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:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.