| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
#ifndef _TRIPLE_H_ |
| 30 |
#define _TRIPLE_H_ |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
template <class A, class B, class C> |
| 35 |
class triple |
| 36 |
{ |
| 37 |
public: |
| 38 |
|
| 39 |
triple() : first(A()), second(B()), third(C()) {} |
| 40 |
triple(const A & first_, const B & second_, const C & third_) : first(first_), second(second_), third(third_) {} |
| 41 |
|
| 42 |
|
| 43 |
triple(const triple & x) : first(x.first), second(x.second), third(x.third) {} |
| 44 |
|
| 45 |
|
| 46 |
inline triple & operator= (const triple & x) { first = x.first; second = x.second; third = x.third; return *this; } |
| 47 |
inline bool operator== (const triple & x) const { return ((first == x.first) && (second == x.second) && (third == x.third)); } |
| 48 |
inline bool operator!= (const triple & x) const { return ((first != x.first) || (second != x.second) || (third != x.third)); } |
| 49 |
bool operator< (const triple & x) const |
| 50 |
{ |
| 51 |
|
| 52 |
if (first < x.first) |
| 53 |
return true; |
| 54 |
if (x.first < first) |
| 55 |
return false; |
| 56 |
|
| 57 |
|
| 58 |
if (second < x.second) |
| 59 |
return true; |
| 60 |
if (x.second < second) |
| 61 |
return false; |
| 62 |
|
| 63 |
|
| 64 |
return (third < x.third); |
| 65 |
} |
| 66 |
|
| 67 |
A first; |
| 68 |
B second; |
| 69 |
C third; |
| 70 |
}; |
| 71 |
|
| 72 |
|
| 73 |
template <class A, class B, class C> |
| 74 |
triple<A,B,C> make_triple(const A & first, const B & second, const C & third) { return triple<A,B,C>(first, second, third); } |
| 75 |
|
| 76 |
#endif |
| 77 |
|