diff --git a/include/common.h b/include/common.h index 6a61cff..27f5844 100644 --- a/include/common.h +++ b/include/common.h @@ -19,6 +19,19 @@ EXPORT std::ostream& COUT(debug_level dl); typedef std::set UsedType; +// We use different format for conversion of double to string +template +inline std::string ToString(T n) { return std::to_string(n); } +template<> +inline std::string ToString(double n) +{ + char buffer[32]; + int i; + i=snprintf(buffer,32,"%.*G",DBL_DIG,n); + return std::string(buffer,i); +} +template<> +inline std::string ToString(std::string s) {return s;} // Base class for all objects class EXPORT ObjectBase @@ -159,7 +172,7 @@ public: bool Print() const override { COUT(NORMAL)< -inline std::string ToString(T n) { return std::to_string(n); } - -template<> -inline std::string ToString(double n) -{ - char buffer[32]; - int i; - i=snprintf(buffer,32,"%.*G",DBL_DIG,n); - return std::string(buffer,i); -} #endif