Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:33:27

0001 #ifndef PhysicsTools_Utilities_Cos_h
0002 #define PhysicsTools_Utilities_Cos_h
0003 
0004 #include <cmath>
0005 
0006 namespace funct {
0007 
0008   template <typename T>
0009   struct CosStruct {
0010     CosStruct(const T& t) : _(t) {}
0011     inline double operator()() const { return ::cos(_()); }
0012     T _;
0013   };
0014 
0015   template <typename T>
0016   struct Cos {
0017     typedef CosStruct<T> type;
0018     inline static type compose(const T& t) { return type(t); }
0019   };
0020 
0021   template <typename T>
0022   inline typename Cos<T>::type cos(const T& t) {
0023     return Cos<T>::compose(t);
0024   }
0025 
0026 }  // namespace funct
0027 
0028 #endif