I have a templated class that can either use float or double as type.
My question is now:
What do I do with constant numbers in the code?
Let's assume I have a multiplication by 0.5:
In the case of float type, I want: 0.5f
In the case of double type, I want: 0.5
One answer would be to check for every constant the type and doing
an if/else, but this is very annoying with lots of constants.
Is there a better way?
The code using these constants infer their type automatically
by the assignment, that's why I have to take care of the constants.