diff --git a/src/tools/Tools.h b/src/tools/Tools.h index 26e9d9eae9..fee3059035 100644 --- a/src/tools/Tools.h +++ b/src/tools/Tools.h @@ -178,7 +178,8 @@ class Tools { /// extension("pippo/.t")="" whereas extension("pippo/a.t")="t" static std::string extension(const std::string&); /// Fast int power - static double fastpow(double base,int exp); + template + static T fastpow(T base,int exp); /// Fast int power for power known at compile time template static inline /*consteval*/ T fastpow(T base); @@ -461,9 +462,8 @@ bool Tools::convertNoexcept(T i,std::string & str) { return true; } -inline -double Tools::fastpow(double base, int exp) -{ +template +inline T Tools::fastpow(T base, int exp) { if(exp<0) { exp=-exp; base=1.0/base;