00001 #ifndef PhysicsTools_Utilities_Sin_h 00002 #define PhysicsTools_Utilities_Sin_h 00003 00004 #include <cmath> 00005 00006 namespace funct { 00007 00008 template<typename T> 00009 struct SinStruct { 00010 SinStruct(const T& t) : _(t) { } 00011 inline double operator()() const { return ::sin(_()); } 00012 T _; 00013 }; 00014 00015 template<typename T> 00016 struct Sin { 00017 typedef SinStruct<T> type; 00018 inline static type compose(const T& t) { return type(t); } 00019 }; 00020 00021 template<typename T> 00022 inline typename Sin<T>::type sin(const T & t) { return Sin<T>::compose(t); } 00023 00024 } 00025 00026 #endif