CMS 3D CMS Logo

Sum.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_Utilities_Sum_h
2 #define PhysicsTools_Utilities_Sum_h
4 
5 namespace funct {
6  template<typename A, typename B>
7  struct SumStruct {
8  SumStruct(const A & a, const B & b) : _1(a), _2(b) { }
9  double operator()() const {
10  return _1() + _2();
11  }
12  operator double() const {
13  return _1() + _2();
14  }
15  double operator()(double x) const {
16  return _1(x) + _2(x);
17  }
18  double operator()(double x, double y) const {
19  return _1(x, y) + _2(x, y);
20  }
21  A _1;
22  B _2;
23  };
24 
25  template<typename A, typename B>
26  struct Sum {
28  static type combine(const A& a, const B& b) { return type(a, b); }
29  };
30 
31  template<typename A, typename B>
32  inline typename Sum<A, B>::type operator+(const A& a, const B& b) {
33  return Sum<A, B>::combine(a, b);
34  }
35 
36 }
37 
38 #endif
Sum< A, B >::type operator+(const A &a, const B &b)
Definition: Sum.h:32
Definition: Abs.h:5
double operator()(double x, double y) const
Definition: Sum.h:18
double operator()(double x) const
Definition: Sum.h:15
SumStruct(const A &a, const B &b)
Definition: Sum.h:8
static type combine(const A &a, const B &b)
Definition: Sum.h:28
SumStruct< A, B > type
Definition: Sum.h:27
double b
Definition: hdecay.h:120
double operator()() const
Definition: Sum.h:9
arg type
Definition: Factorize.h:38
double a
Definition: hdecay.h:121
Definition: Sum.h:26