I have a function that takes different variables with different types and makes calculations with the variables depending on the types.
Is it possible for a class/struct in c++ to pass all public variables to a function?
Something like this:
class some_vars {
int a=3;
double b=5.0;
std::string str="thanks for help";
};
void f(some_vars.commaseparatedvariables);
some_vars.commaseparatedvariables would here be: some_vars.a,some_vars.b,some_vars.str
edit I don't want to enumerate through the class. I just want to pass all public available variables of the class to a function.
edit2 The function can handle a variable number of variables with different types passed to it. So for me it would be natural to pass the class variables and when a change is needed I just have to change them and do not have to change them a second time in the function. (Hope this clears things up.)