#include <Pair.h>
Inheritance diagram for util::Pair< T, U >:

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. | |
| T | 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. | |
| U | 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) |
|
|||||||||
|
The default constructor. Primitive type elements are uninitialized, and complex type elements are initialized using their default constructor. |
|
||||||||||
|
Multiply pair and value. The multiplying of pair and value is defined by the first element of pair and the value. |
|
||||||||||
|
Multiply two pairs. The multiplying of two pairs is defined by their first elements. |
|
||||||||||
|
Adding pair and value. The adding of pair and value is defined by the first element of pair and the value. |
|
||||||||||
|
Adding two pairs. The adding of two pairs is defined by their first elements. |
|
||||||||||
|
Subtract pair and value. The subtracting of pair and value is defined by the first element of pair and the value. |
|
||||||||||
|
Subtract two pairs. The subtracting of two pairs is defined by their first elements. |
|
||||||||||
|
Dividing pair and value. The dividing of pair and value is defined by the first element of pair and the value. |
|
||||||||||
|
Divide two pairs. The dividing of two pairs is defined by their first elements. |
|
||||||||||||||||||||
|
Compare two pairs. Pairs are different if either of their elements are different. |
|
||||||||||||||||||||
|
Compare two pairs. The relative order of two pairs is defined by their first elements. |
|
||||||||||||||||||||
|
Compare two pairs. The relative order of two pairs is defined by their first elements. |
|
||||||||||||||||||||
|
Compare two pairs. Pairs are equal if both of their elements are equal. |
|
||||||||||||||||||||
|
Compare two pairs. The relative order of two pairs is defined by their first elements. |
|
||||||||||||||||||||
|
Compare two pairs. The relative order of two pairs is defined by their first elements. |