I'm making class, that should help with minor deficiencies of C++, like comparing double
with other double
with defined precision, and so on.
I have namespace Utilities
, where class Double
exists:
namespace Utilities {
void init();
class Double {
public:
//! @brief Compares the equality of two doubles with defined precision
static bool fuzzyCompare(const double &d1,const double &d2);
static void setFuzzyComparePrecision(int precision);
private:
//! @brief Private constructor
Double() {};
static int fuzzyComparePrecision_;
};
}
I want this class
to contain only static
members and not be instantiable. Current idea is to call Utilities::init()
function in void main()
, which initializes default values for members of class Double
.
Is it possible to set default fuzzyComparePrecision_
without calling function init()
in void main()
? Or in other words, is it possible to set default value of fuzzyComparePrecision_
without instance of Double
and without calling other function such as init()
?
Thanks for your help!