title: c++ std::tuple of a variadic type list prefix
body: <p>I'm attempting to extract a prefix of types from some variadic type list. Here is my attempt:</p>
  
  <pre><code>#include &lt;tuple&gt;
  #include &lt;type_traits&gt;
  
  template &lt;typename... Ts&gt;
  struct pack{};
  
  template &lt;size_t n, typename... Args&gt;
  struct prefix_tuple;
  
  template &lt;size_t n, typename... TPrefix, typename Tnext, typename... Ts&gt;
  struct prefix_tuple&lt;n, pack&lt;TPrefix...&gt;, Tnext, Ts...&gt;{
      using type = typename 
          prefix_tuple&lt;n-1, pack&lt;TPrefix..., Tnext&gt;, Ts...&gt;::type;
  };
  
  template &lt;typename... TPrefix, typename... Ts&gt;
  struct prefix_tuple&lt;0, pack&lt;TPrefix...&gt;, Ts...&gt;{
      using type = std::tuple&lt;TPrefix...&gt;;
  };
  
  template &lt;size_t n, typename... Args&gt;
  using prefix_tuple_t = typename 
      prefix_tuple&lt;n, pack&lt;&gt;, Args...&gt;::type;
  
  bool f(){
      return std::is_same_v&lt;prefix_tuple_t&lt;2, int, char, double&gt;,
                            std::tuple&lt;int, char&gt; &gt;;
  }
  </code></pre>
  
  <p>This fails on gcc 8.2 with:</p>
  
  <blockquote>
    <p>error: ambiguous template instantiation for 'struct prefix_tuple&lt;0, pack&lt; int, char>, double>'</p>
  </blockquote>
  
  <p>The second specialization appears to be more specific than the first, so I don't see why there's ambiguity here.
  What am I doing wrong?</p>
  
  <p>P.S. This also fails on clang 7.0 with a similar error, but appears to work on icc 19.0.1 and msvc 19.16.</p>