title: How to template'ize variable NAMES, not types?
body: <p>my question is about how to template'ize the <strong><em>name</em></strong> of a class member that should be used.</p>
  
  <p>Maybe a simplified &amp; pseudo example:</p>
  
  <pre><code>/** 
  Does something with a specified member of every element in a List.
  */
  template&lt;membername MEMBER&gt; // &lt;-- How to define such thing?
  void doSomething(std::vector&lt;MyClass&gt; all){
  
      for( i=0; i &lt; all.size(); i++)
        all[i].MEMBER++; // e.g.; use all[i].MEMBER in same way
  
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class MyClass{
  public:
      int aaa, bbb, ccc;
  }
  </code></pre>
  
  <p>and the application:</p>
  
  <pre><code>main(){
      vector&lt;MyClass&gt; all = ....
  
      // applicate doSomething() to all aaa's
      doSomething&lt;aaa&gt;(all);  // or:
      doSomething&lt;MyClass::aaa&gt;(all); // or:
      doSomething&lt;?????&gt;(all);
  }
  </code></pre>
  
  <p>How should the template definition looks like, that I can switch which member variable (aaa, bbb or ccc) of MyClass is accessed/modified in doSomething(.) ?<br>
  In my real world task all MEMBER are of same type, as above.</p>
  
  <p>Thanks,
  Tebas</p>