You can only use integral types for template parameters, but you can fool your way into using fractional values ββusing two integers: one as a mantissa and one as an exponent, or one as a numerator, and one as a denominator. Using the smart metaprogram method, you can even reduce them to the lowest values, so if you use rational methods, then X <3,6> will work the same as X <1,2>
What you can do and what you must do is not necessarily the same. Think about whether this is the right practical approach or just an exercise in the metaprogram.
Cashcow
source share