title: mixing different vector<*> into one vector
body: <p>Suppose there is an object which contains some data members, like this:</p>
  
  <pre><code>class MyObject {
     int age;
     string name;
     bool is_cool;
     …
  
     get(string member_name);  // returns the value of member
  }; 
  </code></pre>
  
  <p>and now there is a <code>MyIterator</code> object by which I could iterate over all the <code>MyObject</code>, and during which I want to get some of the data members of <code>MyObject</code>, like the pseudo code below:</p>
  
  <pre><code>get_members(vector&lt;string&gt; member_names, vector&lt;*&gt; &amp;output) {
    MyIterator it;
    while (it.next_myobject()) {
      for (name in member_names) {
         output.push_back(it.get(name))
      }
    }
  }
  </code></pre>
  
  <p>My problem is, I don’t know how I could implement this idea, but if I only get 1 data member, I know how to implement this by defining a template function, like this:</p>
  
  <pre><code>template &lt;typename T&gt;
  get_member(string member_name, vector&lt;T&gt; &amp;output) {
    MyIterator it;
    while (it.next_myobject()) {
      output.push_back(it.get&lt;T&gt;(member_name));
    }
  }
  </code></pre>
  
  <p>Give me some help :-)</p>