I am refactoring some old code that used its own type handling system which provided a special macro for a type to be used as an argument:
x = function(TYPE(double), y);
After the refactoring, the above is written as
x = function<double>(y);
Is there any way (using a macro or an overloaded function) to keep the old style working as well, providing the backward compatibility? I tried something like this:
#define TYPE(x) (x)
#define function(x, y) function<x>(y)
hoping that the macro will be used only when the actual number of arguments matches its definition, but this leads to compilation errors.
EDIT: more generally, e.g. if you want to support
void, you can do …