title: Explicit specialization of member function template in source file
body: <p>I have a class with a member template function:</p>
  
  <pre><code>// writer.h
  class Writer {
  public:
      ...
      template &lt;typename T, typename V&gt;
      void addField(const std::string&amp; name, V v) 
      {
          // write something
      }
  };
  </code></pre>
  
  <p>And in Writer's source file, I added explicit specializations for <code>some_type</code>:</p>
  
  <pre><code>// writer.cpp
  template &lt;&gt;
  void Writer::addField&lt;some_type, int&gt;(const std::string&amp; name, int v)
  {
      // specific some_type writing logic
  }
  </code></pre>
  
  <p>This works... sometimes. Even if I definitely make sure that I have the right types:</p>
  
  <pre><code>writer.addField&lt;some_type&gt;("name", static_cast&lt;int&gt;(some_value));
  </code></pre>
  
  <p>Sometimes the explicit specialization gets called, and sometimes the primary gets called. What gives?</p>