title: Pass all variables of class to function
body: <p>I have a function that takes different variables with different types and makes calculations with the variables depending on the types.</p>
  
  <p>Is it possible for a class/struct in c++ to pass all public variables to a function?</p>
  
  <p>Something like this:</p>
  
  <pre><code>class some_vars {
  int a=3;
  double b=5.0;
  std::string str="thanks for help";
  };
  
  void f(some_vars.commaseparatedvariables);
  </code></pre>
  
  <p>some_vars.commaseparatedvariables would here be: some_vars.a,some_vars.b,some_vars.str</p>
  
  <p><em>edit</em> I don't want to enumerate through the class. I just want to pass all public available variables of the class to a function.</p>
  
  <p><em>edit2</em> 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.)</p>