How to create a class whose interface matches the double, but whose template types are not dynamically reset to double?
The reason is because I have a runtime type system, and I want to have a type that works just like double:
template<int min_value, int max_value> class BoundedDouble: public double {};
And then use the specialized specialization to get runtime information for this type:
template<typename T> class Type { etc. } template<int min_value, int max_value> class Type<BoundedDouble<min_value, max_value>> { int min() const { return min_value; } etc. }
But you cannot inherit from double ...
source share