title: Variadic template class specialization when empty pack
body: <p>I have a class Data that holds a significant amount of functions.
  That class may also have 0 or N additional types that are necessary in the implementation of the functions of the class:</p>
  
  <pre><code> // in Data.h
  
  template &lt;typename T, typename ...Args&gt;
  class Data
  {
  
      T f1();    
      T f2() const;    
      ... // skipped
      void f10(const T&amp; v);
  
      // Pimpl
      struct Impl;
      Impl* _imp;
  };
  </code></pre>
  
  <p>However, the implementation of <em>some</em> of the functions (but not all!) are completely different if <code>sizeof...(Args) == 0</code> and if <code>sizeof...(Args) &gt; 0</code>: 
  Mainly, the internal private implementation class contains different types.</p>
  
  <pre><code>// in DataImpl.h
  
  template &lt;typename T, typename ...Args&gt;
  struct ImplementationSpecificData;
  
  template &lt;typename T&gt;
  struct ImplementationSpecificData&lt;T&gt;
  {
   // Some members available when sizeof...(Args) == 0
  
  };
  
  template &lt;typename T, typename ...Args&gt;
  struct ImplementationSpecificData&lt;T, Args...&gt;
  {
   // Some members available when sizeof...(Args) &gt; 0
  };
  
  // The pimpl
  template &lt;typename T, typename ...Args&gt; 
  struct Data&lt;T,Args...&gt;::Impl
  {
     // Some common members 
      ...
  
     // Following are specific whether sizeof...(Args) is &gt; 0 or == 0
     ImplementationSpecificData&lt;T,Args...&gt; specificData;
  };
  
  // In Data.cpp
  #include "DataImpl.h"
  </code></pre>
  
  <p>Then, for functions that have an implementation that relies on <em>specificData</em>, I would like to specialize the functions, e.g:</p>
  
  <pre><code>template &lt;typename T, typename ...Args&gt; 
  T
  Data&lt;T,Args...&gt;::f1() {
      // Case where sizeof...(Args) &gt; 0
  }
  </code></pre>
  
  <p>// The following won't work because this is partial member template specialization</p>
  
  <pre><code>template &lt;typename T&gt; 
  T
  Data&lt;T&gt;::f1() {
      // Case where sizeof...(Args) == 0
  }
  </code></pre>
  
  <p>I tried to use an extra Enable template boolean and specialize functions that needed</p>
  
  <pre><code>template &lt;typename T, bool Enable, typename ...Args&gt;
  class Data
  {
  ...
  };
  
  template &lt;typename T, typename ...Args&gt; 
  T
  Data&lt;T, 
  std::integral_constant&lt;bool, sizeof...(Args) &gt; 0&gt;::value,
  Args...&gt;::f1() {
          // Case where sizeof...(Args) &gt; 0
  }
  
  template &lt;typename T, typename ...Args&gt; 
  T
  Data&lt;T, 
  std::integral_constant&lt;bool, sizeof...(Args) == 0&gt;::value,
  Args...&gt;::f1() {
          // Case where sizeof...(Args) == 0
  }
  </code></pre>
  
  <p>But that doesn't work either, I get the following:</p>
  
  <p>nested name specifier <code>Data&lt;T, std::integral_constant&lt;bool, (sizeof...(Args) &gt; 0)&gt;::value, Args...&gt;::</code> for declaration does not refer into a class, class template or class template partial specialization</p>
  
  <p>Is there an elegant way of achieving this, without polluting my API with a base class that contains pure virtual functions and derived class D1 without additional types and a derived class D2 with additional types:
  that would require to maintain the functions signature of the class (and there are a lot of functions) across all those 3 classes (Base, D1 and D2).</p>