title: c++ dynamically accessing member variables
body: <p>Right now I have a switch statement that takes in an input and choose one of the following actions:</p>
  
  <p><strong>Option 1</strong></p>
  
  <pre><code>for(; i &lt; queue_size; ++i)
  {
     prepared-&gt;setString(i+1, queue.at(i).model);
  }
  </code></pre>
  
  <p><strong>Option 2</strong></p>
  
  <pre><code>for(; i &lt; queue_size; ++i)
  {
     prepared-&gt;setString(i+1, queue.at(i).manufacturer);
  }
  </code></pre>
  
  <p><strong>Option 3</strong></p>
  
  <pre><code>for(; i &lt; queue_size; ++i)
  {
     prepared-&gt;setString(i+1, queue.at(i).name);
  }
  </code></pre>
  
  <p>In PHP, you would be able to do the same doing something like this:</p>
  
  <pre><code>$queue[i][$member];
  </code></pre>
  
  <p>$member could then be set to "name", "manufacturer", etc.</p>
  
  <p>Is there any way to do something similar or more robust in C++?</p>
  
  <p>Thanks in advance for any help/suggestions!</p>