I need some constant and found that I can get it in the standard library ratio, but not directly. Suppose I want a double value one_nano, I can do this.
const double one_nano = (double)nano::num / nano::den;
But personally I don’t believe that’s better than this:
const double one_nano = 1e-9;
I just don’t want to define the constant myself, is there something like nano::value or anything else?
Defining a constant directly is more readable. If you think it’s ugly, you could always just put it in a header rather than at the top of your code.