title: Iterate in reverse order through the parameter-pack of a variadic template function
body: <p>I'm trying to iterate in reverse order through the parameter-pack of a variadic template function. My idea was to use tail recursion and a specialized &quot;empty&quot; template function to stop the recursion:</p>
  <pre><code>#include &lt;iostream&gt;
  
  template&lt;&gt;
  void f() {}
  
  template&lt;int H, int... T&gt;
  void f()
  {
      f&lt;T...&gt;();
      std::cout &lt;&lt; H &lt;&lt; std::endl;
  }
  
  int main()
  {
      f&lt;1,2,3,4,5&gt;();
  
      return 0;
  }
  </code></pre>
  <p>However the code above does not compile:</p>
  <blockquote>
  <pre><code>p.cc:25:8: error: ‘f’ is not a template function
   void f() {}
          ^
  p.cc: In instantiation of ‘void f() [with int H = 5; int ...T = {}]’:
  p.cc:30:12:   recursively required from ‘void f() [with int H = 2; int ...T = {3, 4, 5}]’
  p.cc:30:12:   required from ‘void f() [with int H = 1; int ...T = {2, 3, 4, 5}]’
  p.cc:36:18:   required from here
  p.cc:30:12: error: no matching function for call to ‘f()’
       f&lt;T...&gt;();
              ^
  p.cc:28:6: note: candidate: template&lt;int H, int ...T&gt; void f()
   void f()
        ^
  p.cc:28:6: note:   template argument deduction/substitution failed:
  p.cc:30:12: note:   couldn't deduce template parameter ‘H’
       f&lt;T...&gt;();
  </code></pre>
  </blockquote>
  <p>I <em>feel</em> this is just a syntax error -- but I'm unable to find the solution by myself. Any idea?</p>