title: Unpacking std::pair<T,std::pair<U, std::pair<...>>> to tuple<T,U,...>
body: <p>So I'm trying to come up with a function which converts a;</p>
  
  <pre><code>std::pair&lt;T,std::pair&lt;U, V&gt;&gt;
  </code></pre>
  
  <p>data type, into a <code>std::tuple</code>;</p>
  
  <pre><code>std::tuple&lt;T,U,V&gt;
  </code></pre>
  
  <p>It should work in the general case, with an arbitrary number of mixed type arguments, the format for the pairs is that;</p>
  
  <ul>
  <li>the 'car' will always be a type,</li>
  <li>the 'cdr' will always be a <code>std::pair</code>,
  <ul>
  <li>except for the innermost case, where the 'cdr' will be a type itself <br>
  (however this might be a <code>std::pair</code> itself, as the type is arbitrary).</li>
  </ul></li>
  </ul>
  
  <p>The number and type of arguments I want to retrieve is known in advance, through a variadic template argument.</p>
  
  <p>My current progress is somewhat low, I'm been trying a few things, however it seems like the code I need is along these lines;</p>
  
  <pre><code>std::make_tuple(get&lt;0&gt;(pair), get&lt;0&gt;(get&lt;1&gt;(pair), get&lt;0&gt;(get&lt;1&gt;(get&lt;1&gt;(pair), ..., get&lt;1&gt;(pair)))));
  </code></pre>
  
  <p>However I can't seem to find a way to automatically generate this, I tried the <code>Sequence&lt;int...&gt;</code> approach, but without luck, however I do think it's something along those lines that I need to consider, for instance having a get method, which takes a variable number of indexes, and uses these to lookup multiple times, using the ordinary get method?</p>