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