CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/PhysicsTools/Utilities/interface/Cos.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_Utilities_Cos_h
00002 #define PhysicsTools_Utilities_Cos_h
00003 
00004 #include <cmath>
00005 
00006 namespace funct {
00007 
00008   template<typename T>
00009   struct CosStruct {
00010     CosStruct(const T& t) : _(t) { }
00011     inline double operator()() const { return ::cos(_()); }
00012     T _; 
00013   };
00014 
00015   template<typename T>
00016   struct Cos {
00017     typedef CosStruct<T> type;
00018     inline static type compose(const T& t) { return type(t); }
00019   };
00020 
00021   template<typename T>
00022   inline typename Cos<T>::type cos(const T & t) { return Cos<T>::compose(t); }
00023 
00024 }
00025 
00026 #endif