CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/TrackingTools/GsfTracking/interface/Triplet.h

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