title: Partial specialization of templates with integer parameters
body: <p>I'm trying to do some partial specialization stuff. I have a <code>tuple</code>, and I want to iterate from a certain element index to the first tuple index, accumulating a value from each type in the <code>tuple</code>. This would seem to be a simple matter of using a recursive template instantiation.</p>
  
  <p>The problem is, I can't seem to get the recursion to work. In order to stop the recursion, I need to partially specialize the template function at tuple index 0. That seemed simple enough, but it's not working.</p>
  
  <p>Note: I've removed the actual <code>tuple</code> stuff from the example, as it's irrelevant; it's the template specialization that's not working.</p>
  
  <pre><code>template&lt;int Index, typename Tpl&gt;
  size_t CalcInterleaveByteOffset(const Tpl &amp;t)
  {
      size_t prevOffset = CalcInterleaveByteOffset&lt;Index - 1&gt;(t);
      return prevOffset + sizeof(Tpl);
  }
  
  template&lt;typename Tpl&gt;
  size_t CalcInterleaveByteOffset&lt;0, Tpl&gt;(const Tpl &amp;t)
  {
      return 0;
  }
  </code></pre>
  
  <p><a href="http://ideone.com/N0Lu0">GCC simply says that this kind of specialization is not allowed.</a> Is that true? Is there some other way to handle this sort of thing?</p>