title: C++ equivalent of Python getattr
body: <p>In python, there is a function called getattr which would look like this:</p>
  
  <pre><code>class MyObject():
      def __init__(self):
          self.xyz = 4
  
  obj = MyObject()
  getattr(obj, 'xyz')
  </code></pre>
  
  <p>where the call to getattr would return 4. </p>
  
  <p>Is there a similar way to do this in C++ (Not Visual C++)? </p>
  
  <p>Are there any libraries that have this functionality where I can lookup an object's member variables using a string? </p>
  
  <p>I am trying to find a way to look up public data members in a C++ class that I cannot change. So I cannot use a map to map string literals to values. Maybe like an 'unstringify' with macros?</p>