CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/PhysicsTools/Utilities/interface/Difference.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_Utilities_Difference_h
00002 #define PhysicsTools_Utilities_Difference_h
00003 #include "PhysicsTools/Utilities/interface/Sum.h"
00004 #include "PhysicsTools/Utilities/interface/Minus.h"
00005 
00006 namespace funct {
00007 
00008   template<typename A, typename B>
00009   struct Difference { 
00010     typedef typename Sum<A, typename Minus<B>::type>::type type; 
00011     inline static type combine(const A& a, const B& b) { return a + (-b); }
00012   };
00013 
00014   template<typename A, typename B>
00015   inline typename Difference<A, B>::type operator-(const A& a, const B& b) {
00016     return Difference<A, B>::combine(a, b);
00017   }
00018 
00019 }
00020 
00021 #endif