title: Specializing nested templates
body: <p>I have a class template A which looks like this. Consider TImpl1 and TImpl2 as arguments that define the implementations of abstract data types B and C to solve a problem that belongs to A:</p>
  
  <pre><code>template &lt;typename TImpl1, typename TImpl2, typename TImpl3&gt;
  A&lt;B&lt;TImpl1, TImpl2&gt;, C&lt;TImpl3&gt; &gt;
  </code></pre>
  
  <p>I also have a lot of non-member functions that get an instance of A, call each other and do something with A. Now I want to change the specification of a single method for a specific kind of A-classes that I'm going to introduce.</p>
  
  <p>The easy way: I introduce an empty struct "SpecialClass" and do partial specialization:</p>
  
  <pre><code>struct SepcialClass;
  
  // method already existed
  template &lt;typename TImpl1, typename TImpl2, typename TImpl3&gt;
  method1024(A&lt;B&lt;TImpl1, TImpl2&gt;, C&lt;TImpl3&gt; &gt; a) {
     ...
  }
  
  // new method for only some 
  template &lt;typename TImpl1, typename TImpl2&gt;
  method1024(A&lt;B&lt;TImpl1, TImpl2&gt;, C&lt;SpecialClass&gt; &gt; a) {
     ...
  }
  </code></pre>
  
  <p>So whenever I declare <code>A&lt;B&lt;...&gt;,C&lt;SpecialClass&gt; &gt;</code>, all the methods run properly and for method1024 the specialized one is chosen.</p>
  
  <p>This totally works, but: I lost the possiblity to specify the implementation of C.</p>
  
  <p>Unfortunately I cannot redesign A by adding a third argument to it.</p>
  
  <p>Are there any other ideas / workarounds for this kind of problem?</p>