00001
00002
00003 #ifndef _tuples_H_
00004 #define _tuples_H_
00005
00006
00007 #include "iostream"
00008 using namespace std;
00009
00010
00011
00012
00013
00014
00015
00016 template< class T1 , class T2 , class T3 >
00017 class triple
00018 {
00019
00021
00022
00023
00025
00026 public:
00027
00028 triple( const T1& t1=T1() , const T2& t2=T2() , const T3& t3=T3() ) : first(t1), second(t2), third(t3) { }
00029
00030
00032
00033
00034
00036
00037 public:
00038
00039 bool operator == ( const triple& t ) const {
00040 return first==t.first && second==t.second && third==t.third;
00041 }
00042
00043 bool operator< ( const triple& t ) const {
00044 if( first<t.first )
00045 return true;
00046 if( first>t.first )
00047 return false;
00048
00049 if( second<t.second )
00050 return true;
00051 if( second>t.second )
00052 return false;
00053
00054 if( third<t.third )
00055 return true;
00056 return false;
00057 }
00058
00060
00061
00062
00064
00065 public:
00066
00067 friend ostream& operator << ( ostream& os , const triple& t ) {
00068 os << "<" << t.first << "," << t.second << "," << t.third << ">";
00069 return os;
00070 }
00071
00073
00074
00075
00077
00078 public:
00079
00080 T1 first;
00081 T2 second;
00082 T3 third;
00083 };
00084
00085
00086
00087
00088
00089
00090
00091
00092 template< class T1 , class T2 , class T3 , class T4 >
00093 class quadruple
00094 {
00095
00097
00098
00099
00101
00102 public:
00103
00104 quadruple( const T1& t1=T1() , const T2& t2=T2() , const T3& t3=T3() , const T4& t4=T4() ) : first(t1), second(t2), third(t3), fourth(t4) { }
00105
00106
00108
00109
00110
00112
00113 public:
00114
00115 bool operator< ( const quadruple& q ) const {
00116 if( first<q.first )
00117 return true;
00118 if( first>q.first )
00119 return false;
00120
00121 if( second<q.second )
00122 return true;
00123 if( second>q.second )
00124 return false;
00125
00126 if( third<q.third )
00127 return true;
00128 if( third>q.third )
00129 return false;
00130
00131 if( fourth<q.fourth )
00132 return true;
00133 return false;
00134 }
00135
00137
00138
00139
00141
00142 public:
00143
00144 friend ostream& operator << ( ostream& os , const quadruple& t ) {
00145 os << "<" << t.first << "," << t.second << "," << t.third << "," << t.fourth << ">";
00146 return os;
00147 }
00148
00150
00151
00152
00154
00155 public:
00156
00157 T1 first;
00158 T2 second;
00159 T3 third;
00160 T4 fourth;
00161 };
00162
00163
00164 #endif
00165