title: Non-type variadic function templates in C++11
body: <p>I saw a <a href="http://cpptruths.blogspot.com/2011/10/multi-dimensional-arrays-in-c11.html" rel="noreferrer">blog post</a> which used non-type variadic templates (currently not supported by gcc, only by clang).</p>
  
  <pre><code>template &lt;class T, size_t... Dimensions&gt;
  struct MultiDimArray { /* ... */ };
  </code></pre>
  
  <p>The example in the post compiles fine but I failed to get it to work with function templates.</p>
  
  <p>Can anyone help figuring out the correct syntax (if such exists)?</p>
  
  <pre><code>int max(int n) { return n; } // end condition
  
  template &lt;int... N&gt; // replacing int... with typename... works
  int max(int n, N... rest) // !! error: unknown type name 'N'
  {
      int tmp = max(rest...);
      return n &lt; tmp? tmp : n;
  }
  
  #include &lt;iostream&gt;
  int main() 
  {
     std::cout &lt;&lt; max(3, 1, 4, 2, 5, 0) &lt;&lt; std::endl;   
  }
  </code></pre>