title: C++11 way to index tuple at runtime without using switch
body: <p>I have a piece of c++11 code similar like below:</p>
  
  <pre><code>switch(var) {
     case 1: dosomething(std::get&lt;1&gt;(tuple));
     case 2: dosomething(std::get&lt;2&gt;(tuple));
     ...
  }
  </code></pre>
  
  <p>Is there any way to remove this large switch ? Note that <code>get&lt;var&gt;</code> does not work because var is not constant, but I know var is in small range i.e. (0-20).</p>
  
  <p>Note that the point here is to avoid using an array that causes an array lookup... </p>
  
  <p>EDIT:</p>
  
  <p>well on the issue of performance, there is a discussion
  <a href="https://stackoverflow.com/questions/5582261/performance-of-array-of-functions-over-if-and-switch-statements">Performance of array of functions over if and switch statements</a></p>
  
  <p>For my own purpose, I do not argue which one is better.</p>