Why implementation order matters in "Why Not Specialize Function Templates"
<p>I have run the following code through VS2010.</p>

<pre><code>#include &lt;iostream&gt;

template&lt;class T&gt; // (a) a base template 
void f( T )
{    std::cout &lt;&lt; "(a)" &lt;&lt; std::endll;}

template&lt;class T&gt; // (b) a second base template, overloads (a) 
void f( T* )     //     (function templates can't be partially 
{    std::cout &lt;&lt; "(b)" &lt;&lt; std::endll;}

template&lt;&gt;        // (c) explicit specialization of (b) 
void f&lt;&gt;(int*)
{    std::cout &lt;&lt; "(c)" &lt;&lt; std::endll;}

int main(int argc, char* argv[])
{
    int *p = new int(10); 
    f( p ); // '(c)'

    return 0;
}
</code></pre>

<p>/////////////////</p>

<pre><code>#include &lt;iostream&gt;

template&lt;class T&gt; // (a) same old base template as before 
void f( T )
{    std::cout &lt;&lt; "(a)" &lt;&lt; std::endll;}

template&lt;&gt;        // (c) explicit specialization, this time of (a)
void f&lt;&gt;(int*)
{    std::cout &lt;&lt; "(c)" &lt;&lt; std::endll;}

template&lt;class T&gt; // (b) a second base template, overloads (a) 
void f( T* )
{    std::cout &lt;&lt; "(b)" &lt;&lt; std::endll;}

int main(int argc, char* argv[])
{
    int *p = new int(10); 
    f( p ); // '(b)'

    return 0;
}
</code></pre>

<p>The output result is <code>(c)</code>. 
However, if I move the block of (c) code in front of (b), then the output result is <code>(b)</code>.
I have read the related article <a href="http://www.gotw.ca/publications/mill17.htm" rel="nofollow">http://www.gotw.ca/publications/mill17.htm</a> here. Still get confused.</p>

<p>Why the order of the code matters in the case?</p>
