CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Triplet.h
Go to the documentation of this file.
1 #ifndef Triplet_H
2 #define Triplet_H
3 
8 template <class T1, class T2, class T3>
9 struct Triplet {
10  typedef T1 first_type;
11  typedef T2 second_type;
12  typedef T3 third_type;
13 
14  T1 first;
15  T2 second;
16  T3 third;
17  Triplet() : first(T1()), second(T2()), third(T3()) {}
18  Triplet(const T1& a, const T2& b, const T3& c) :
19  first(a), second(b), third(c) {}
20 
21  template <class U1, class U2, class U3>
23  first(p.first), second(p.second), third(p.third) {}
24 };
25 
26 template <class T1, class T2, class T3>
27 inline bool operator==(const Triplet<T1, T2, T3>& x,
28  const Triplet<T1, T2, T3>& y) {
29  return x.first == y.first && x.second == y.second && x.third==y.third;
30 }
31 
32 template <class T1, class T2, class T3>
33 inline bool operator<(const Triplet<T1, T2, T3>& x,
34  const Triplet<T1, T2, T3>& y) {
35  bool pair_less =
36  x.first < y.first || (!(y.first < x.first) && x.second < y.second);
37 
38  return pair_less ||
39  (!(y.first < x.first) && !(y.second < x.second) && x.third < y.third);
40 }
41 
42 template <class T1, class T2, class T3>
43 inline Triplet<T1, T2, T3> make_Triplet(const T1& x, const T2& y, const T3& z) {
44  return Triplet<T1, T2, T3>(x, y, z);
45 }
46 
47 #endif
T2 second_type
Definition: Triplet.h:11
T1 first_type
Definition: Triplet.h:10
bool operator==(const CaloTower &t1, const CaloTower &t2)
Definition: CaloTower.h:209
Definition: Triplet.h:9
float float float z
Triplet< T1, T2, T3 > make_Triplet(const T1 &x, const T2 &y, const T3 &z)
Definition: Triplet.h:43
T3 third_type
Definition: Triplet.h:12
T2 second
Definition: Triplet.h:15
T3 third
Definition: Triplet.h:16
T1 first
Definition: Triplet.h:14
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
Definition: DDAxes.h:10
Triplet(const Triplet< U1, U2, U3 > &p)
Definition: Triplet.h:22
Triplet(const T1 &a, const T2 &b, const T3 &c)
Definition: Triplet.h:18
Triplet()
Definition: Triplet.h:17