title: Access tuple element in C++11 via compile time variable in function
body: <p>The following minimal example compiles with <code>g++ -std=c++11 -Wall tuple.cpp -o tuple</code>:</p>
  
  <pre><code>#include &lt;tuple&gt;
  #include &lt;iostream&gt;
  
  template&lt;int i&gt;
  char get_elem_i(std::tuple&lt;char, char&gt; t)
  {
      return std::get&lt;i&gt;(t);
  }
  
  int main()
  {
      std::tuple&lt;char, char&gt; t('H','i');
      char c = get_elem_i&lt;0&gt;(t);
      std::cout &lt;&lt; "The char is: " &lt;&lt; c &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>Now, I do not want to use a template which specifies the index (the exact reason why: I have templates that are deduced automatically, and I do not want to need to specify them all). So my first try was:</p>
  
  <pre><code>char get_elem_i(int i, std::tuple&lt;char, char&gt; t)
  {
      return std::get&lt;i&gt;(t);
  }
  </code></pre>
  
  <p>I understand that this can not compile. Is there any way to assure the compiler that <code>i</code> will be known at compile time? Maybe something like this?</p>
  
  <pre><code>char get_elem_i(compile_time_known int i, std::tuple&lt;char, char&gt; t)
  </code></pre>