title: Traversing nested C++11 tuple
body: <p>If I have this tuple type:</p>
  
  <p><code>std::tuple&lt;int, string, std::tuple&lt;...&gt;, int&gt;</code></p>
  
  <p>How can I traverse it? I've been able to write functions that traverse a flat tuple, but not with nested tuples.</p>
  
  <p>The problem seems to be for any implementation of a templated function or type that handles all the conceivable types in a nested tuple, there must be this case:</p>
  
  <pre><code>template&lt;typename T&gt;
  void somefunc(T t)
  {
      // Do something to t
  }
  </code></pre>
  
  <p>Which ends up being the best choice for overload resolution for every type, and you can't recursively traverse the tuple because you lose the information that it's a tuple. If you try to write a class or function that tries to determine whether it's a tuple or not, you still run in to the "false" case which has the same problem as above in that it ends up matching for every type and the tuple specialized version gets overlooked.</p>
  
  <p>Is there a way I'm not aware of to check whether something is a tuple?</p>