00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ThePEG_Triplet_H
00010 #define ThePEG_Triplet_H
00011
00012 #include "ThePEG/Config/ThePEG.h"
00013
00014 namespace ThePEG {
00015
00020 template <typename T1, typename T2, typename T3>
00021 struct Triplet {
00022
00024 typedef T1 first_type;
00026 typedef T2 second_type;
00028 typedef T3 third_type;
00029
00031 T1 first;
00033 T2 second;
00035 T3 third;
00036
00038 Triplet() : first(T1()), second(T2()), third(T3()) {}
00039
00041 Triplet(const T1 & t1, const T2 & t2, const T3 & t3)
00042 : first(t1), second(t2), third(t3) {}
00043
00045 Triplet(const Triplet<T1,T2,T3> & t)
00046 : first(t.first), second(t.second), third(t.third) {}
00047
00049 template <typename U1, typename U2, typename U3>
00050 Triplet(const Triplet<U1,U2,U3> & u)
00051 : first(u.first), second(u.second), third(u.third) {}
00052
00054 bool operator==(const Triplet<T1,T2,T3> & t) const {
00055 return first == t.first && second == t.second && third == t.third;
00056 }
00057
00062 bool operator<(const Triplet<T1,T2,T3> & t) const {
00063 return first < t.first ||
00064 ( !(t.first < first) &&
00065 ( second < t.second ||
00066 ( !(t.second < second) && third < t.third )));
00067 }
00068 };
00069
00072 template <typename T1, typename T2, typename T3>
00073 inline Triplet<T1,T2,T3>
00074 makeTriplet (const T1 & t1, const T2 & t2, const T3 & t3)
00075 {
00076 return Triplet<T1,T2,T3>(t1, t2, t3);
00077 }
00078
00080 template <typename OStream, typename T1, typename T2, typename T3>
00081 OStream & operator<<(OStream & os, const Triplet<T1,T2,T3> & t) {
00082 return os << t.first << t.second << t.third;
00083 }
00084
00086 template <typename IStream, typename T1, typename T2, typename T3>
00087 IStream & operator>>(IStream & is, Triplet<T1,T2,T3> & t) {
00088 return is >> t.first >> t.second >> t.third;
00089 }
00090
00091 }
00092
00093 #endif