I am trying to perform some generic number manipulation independent of the number type. However, I know of no way to use generics to do this. The first idea was to filter th
Rewriting is probably easiest. The only other solution I can come up with is to go beyond templates, write a String that represents your function, with placeholder chars for the type, then replace it with each type name and compile it at runtime.
Apart from the initial performance hit due to compilation it will also be difficult to call these functions.
There's no common interface for arithmetic operations implemented by numeric types. Generic operators might help solving your problem.