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 { return _1() * _2(); }
10  operator double() const { return _1() * _2(); }
11  double operator()(double x) const { return _1(x) * _2(x); }
12  double operator()(double x, double y) const { return _1(x, y) * _2(x, y); }
13  A _1;
14  B _2;
15  };
16 
17  template <typename A, typename B>
18  struct Product {
20  static type combine(const A& a, const B& b) { return type(a, b); }
21  };
22 
23  template <typename A, typename B>
24  inline typename Product<A, B>::type operator*(const A& a, const B& b) {
25  return Product<A, B>::combine(a, b);
26  }
27 } // namespace funct
28 
29 #endif
Definition: Abs.h:5
double operator()(double x, double y) const
Definition: Product.h:12
ProductStruct(const A &a, const B &b)
Definition: Product.h:8
ProductStruct< A, B > type
Definition: Product.h:19
double operator()() const
Definition: Product.h:9
static type combine(const A &a, const B &b)
Definition: Product.h:20
double b
Definition: hdecay.h:118
arg type
Definition: Factorize.h:37
double a
Definition: hdecay.h:119
Product< A, B >::type operator*(const A &a, const B &b)
Definition: Product.h:24
double operator()(double x) const
Definition: Product.h:11