title: How to get a list of a class's member variables in C++?
body: <p>Is there a way that I could obtain a list or maybe iterate through a list of each member variable of a class -regardless of it's type. </p>
  
  <p>My intention is to add them all to a template std::map.</p>
  
  <pre><code>class Person
  {
      int Age;
      char *Name;
      template&lt;typename Container&gt; std::map&lt;char *, Container&gt; List;
      void MakeList()
      {
         for(auto i : Person.memberVariables)
         {
             List.emplace(i);
         }
      }
  };
  </code></pre>
  
  <p>Could I do something like the above to add each variable of my class to the list, regardless of how incorrect the other code is. The adding to the list is what I'm interested in. </p>
  
  <p>Thanks in advance.</p>