title: using SFINAE for template class specialisation
body: <p>suppose I have these declarations</p>
  
  <pre><code>template&lt;typename T&gt; class User;
  template&lt;typename T&gt; class Data;
  </code></pre>
  
  <p>and want to implement <code>User&lt;&gt;</code> for <code>T = Data&lt;some_type&gt;</code> <em>and any class derived from <code>Data&lt;some_type&gt;</code></em> but also allow for other specialisations defined elsewhere.</p>
  
  <p>If I didn't already have the declaration of the class template <code>User&lt;&gt;</code>, I could simply</p>
  
  <pre><code>template&lt;typename T,
           typename A= typename std::enable_if&lt;is_Data&lt;T&gt;::value&gt;::type&gt;
  class User { /*...*/ };
  </code></pre>
  
  <p>where</p>
  
  <pre><code>template&lt;template&lt;typename&gt; data&gt;&gt; struct is_Data
  { static const bool value = /* some magic here (not the question) */; };
  </code></pre>
  
  <p>However, this has two template parameters and thus clashes with the previous declaration, where <code>User&lt;&gt;</code> is declared with only one template parameter. Is there anything else I can do?</p>
  
  <p>(Note</p>
  
  <pre><code>template&lt;typename T,
           typename A= typename std::enable_if&lt;is_Data&lt;T&gt;::value&gt;::type&gt;
  class User&lt;T&gt; { /*...*/ };
  </code></pre>
  
  <p>doesn't work (<em>default template arguments may not be used in partial specializations</em>),
  nor does</p>
  
  <pre><code>template&lt;typename T&gt; class User&lt;Data&lt;T&gt;&gt; { /*...*/ };
  </code></pre>
  
  <p>as it doesn't allow types derived from <code>Data&lt;&gt;</code>, neither does</p>
  
  <pre><code>template&lt;typename T&gt;
  class User&lt;typename std::enable_if&lt;is_Data&lt;T&gt;::value,T&gt;::type&gt;
  { /*...*/ };
  </code></pre>
  
  <p>since <em>template parameter <code>T</code> is not used in partial specialization</em>.)</p>