triple.h

Go to the documentation of this file.
00001 #ifndef __triple_h
00002 #define __triple_h
00003 
00004 namespace Gascoigne
00005 {
00006 template <class T1, class T2, class T3>
00007 struct triple {
00008   typedef T1 first_type;
00009   typedef T2 second_type;
00010   typedef T3 third_type;
00011 
00012   T1 first;
00013   T2 second;
00014   T3 third;
00015   triple() : first(T1()), second(T2()), third(T3()) {}
00016   triple(const T1& a, const T2& b, const T3& c) : first(a), second(b), third(c) {}
00017 
00018 #ifdef __STL_MEMBER_TEMPLATES
00019   template <class U1, class U2, class U3>
00020   triple(const triple<U1, U2, U3>& p) : first(p.first), second(p.second), third(p.third) {}
00021 #endif
00022 };
00023 
00024 template <class T1, class T2, class T3>
00025 inline bool operator==(const triple<T1, T2, T3>& x, const triple<T1, T2, T3>& y) { 
00026   return x.first == y.first && x.second == y.second && x.third == y.third; 
00027 }
00028 
00029 template <class T1, class T2, class T3>
00030 inline bool operator<(const triple<T1, T2, T3>& x, const triple<T1, T2, T3>& y) { 
00031   return x.first < y.first || (!(y.first < x.first) && x.second < y.second)
00032     || ( !(y.first < x.first) && !(y.second < x.second) && x.third < y.third)  ; 
00033 }
00034 
00035 template <class T1, class T2, class T3>
00036 inline triple<T1, T2, T3> make_triple(const T1& x, const T2& y, const T3& z) {
00037   return triple<T1, T2, T3>(x, y,z);
00038 }
00039 }
00040 #endif

Generated on Thu Sep 14 10:34:35 2006 for Gascoigne by  doxygen 1.4.7