CMS 3D CMS Logo

Product.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_Utilities_Product_h
2 #define PhysicsTools_Utilities_Product_h
3 #include <boost/static_assert.hpp>
4 
5 namespace funct {
6  template<typename A, typename B>
7  struct ProductStruct {
8  ProductStruct(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 Product {
28  static type combine(const A& a, const B& b) {
29  return type(a, b);
30  }
31  };
32 
33  template<typename A, typename B>
34  inline typename Product<A, B>::type operator*(const A& a, const B& b) {
35  return Product<A, B>::combine(a, b);
36  }
37 }
38 
39 #endif
Definition: Abs.h:5
double operator()(double x, double y) const
Definition: Product.h:18
ProductStruct(const A &a, const B &b)
Definition: Product.h:8
ProductStruct< A, B > type
Definition: Product.h:27
double operator()() const
Definition: Product.h:9
static type combine(const A &a, const B &b)
Definition: Product.h:28
double b
Definition: hdecay.h:120
arg type
Definition: Factorize.h:39
double a
Definition: hdecay.h:121
Product< A, B >::type operator*(const A &a, const B &b)
Definition: Product.h:34
double operator()(double x) const
Definition: Product.h:15