We have written a large library functions whose prototypes mostly look like:
void my_fun(
const in_class & in_param_1,
const in_class & in_param_2,
const in_class & in_param_3,
out_class & out_param);
Is there a generic way to wrap these functions so that the following is equivalent (assuming out_param is only written to in my_fun):
out_class my_out;
my_fun(my_in1,my_in2,my_in3,my_out);
and
out_class my_out = generic_wrapper(&my_fun,my_in1,my_in2,my_in3);
How could one write such a generic_wrapper? If this is possible it also possible to write it so that the number of input parameters is variable, so I could use it say with my_fun2 that perhaps takes 4 in_param_’s?
Consider all cases: