File indexing completed on 2023-03-17 11:16:53
0001 #ifndef PhysicsTools_Utilities_Minus_h
0002 #define PhysicsTools_Utilities_Minus_h
0003
0004 namespace funct {
0005
0006 template <typename A>
0007 struct MinusStruct {
0008 MinusStruct() : _() {}
0009 MinusStruct(const A& a) : _(a) {}
0010 operator double() const { return -_(); }
0011 double operator()() const { return -_(); }
0012 double operator()(double x) const { return -_(x); }
0013 double operator()(double x, double y) const { return -_(x, y); }
0014 A _;
0015 };
0016
0017 template <typename A>
0018 struct Minus {
0019 typedef MinusStruct<A> type;
0020 static type operate(const A& a) { return type(a); }
0021 };
0022
0023 template <typename A>
0024 inline typename Minus<A>::type operator-(const A& a) {
0025 return Minus<A>::operate(a);
0026 }
0027 }
0028
0029 #endif