CMS 3D CMS Logo

Minus.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_Utilities_Minus_h
00002 #define PhysicsTools_Utilities_Minus_h
00003 
00004 namespace funct {
00005 
00006   template<typename A>
00007   struct MinusStruct { 
00008     MinusStruct() : _() { }
00009     MinusStruct(const A & a) : _(a) { }
00010     operator double() const {
00011       return - _();
00012     }
00013     double operator()() const {
00014       return - _();
00015     }
00016     double operator()(double x) const {
00017       return - _(x);
00018     }
00019     double operator()(double x, double y) const {
00020       return - _(x, y);
00021     }
00022     A _; 
00023   };
00024 
00025   template<typename A>
00026   struct Minus {
00027     typedef MinusStruct<A> type;
00028     static type operate(const A& a) {
00029       return type(a);
00030     }
00031   };
00032 
00033   template<typename A>
00034   inline typename Minus<A>::type operator-(const A& a) {
00035     return Minus<A>::operate(a);
00036   }
00037 }
00038 
00039 #endif

Generated on Tue Jun 9 17:42:42 2009 for CMSSW by  doxygen 1.5.4