Explicit template specialization issue
<pre><code>template &lt;class T&gt;
class Test
{
public:
    template&lt;class U&gt; void f(); //generic function

    template&lt;&gt; void f&lt;char&gt;(); //Specialization for char.
};

template &lt;class T&gt;
template&lt;class U&gt; 
void Test&lt;T&gt;::f()   //Definition of generic function
{
}

template&lt;&gt;
template&lt;&gt; void Test&lt;char&gt;::f&lt;char&gt;(){}  //Definition of specialization.

int main()
{
    Test&lt;char&gt; ob1;
    ob1.f&lt;char&gt;(); //Works fine.

    Test&lt;int&gt; ob2;
    ob2.f&lt;char&gt;();  //Produces linker error.
}
</code></pre>

<p>Linker error is </p>

<pre><code>error LNK2019: unresolved external symbol "public: void __thiscall
Test&lt;int&gt;::f&lt;char&gt;(void)"
</code></pre>

<p>My requirement is: I should be able to pass any type to Test class and any type to function f(). I should be able to use all combinations of types like below.</p>

<blockquote>
<pre><code>  Test   f()
  --------------
  int    char
  char   int
  int    int
</code></pre>
</blockquote>

<p>I can solve the error by defining another function like below.</p>

<pre><code>template&lt;&gt;
template&lt;&gt; void Test&lt;int&gt;::f&lt;char&gt;(){}
</code></pre>

<p>But then what is the use of making Test class as Template ? How to make it work for all combinations ?</p>
