title: Specializing only one method of a class template
body: <p>I have a class template that works correctly for all possible types T1, T2.</p>
  
  <pre><code>template &lt;typename T1, typename T2&gt;
  class Basic {
      int a;
      float b;
  
  public:
      void foo(T1 t1, T2 t2) {
          // use a, b, t1, t2
      }
  };
  </code></pre>
  
  <p>However, there is one case when <code>T2</code> is <code>char</code>, and I expect <code>foo</code> to behave differently.</p>
  
  <p>So I tried specializing <em>only</em> that method:</p>
  
  <pre><code>template &lt;typename T1&gt;
  class Basic&lt;T1, char&gt; {
      void foo(T1 t1, char t2) {
          // try using a, b, t1, t2 in a very special way
  
          // ERROR:
          // use of undeclared identifier: a
          // use of undeclared identifier: b
      }
  };
  </code></pre>
  
  <p>Problem is, there are potentially a lot of different data members and methods in the template class <code>Basic</code>, that are not necessarily related to the function <code>foo</code>. </p>
  
  <p>That being said, I feel like full class specialization would be a bloat. Is there a better solution?</p>