title: Specializing Template Constructor Of Template Class
body: <p>My brain has melted due to several weeks of 14-hour days.  </p>
  
  <p>I have a template class, and I'm trying to write a template convert constructor for this class, and specialize that constructor.  The compiler (MSVC9) is quite displeased with me.  This is a minimal example of actual code I'm trying to write.  The compiler error is inline with the code.</p>
  
  <p>Help me unmelt my brain.  What's the syntax I need here to do what I'm trying to do?  NOTE:  In my real code, I <em>must</em> define the convert constructor outside of the declaration, so that's not an option for me.</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;sstream&gt;
  using namespace std;
  
  template&lt;typename A&gt;
  class Gizmo
  {
  public:
      Gizmo() : a_() {};
      Gizmo(const A&amp; a) : a_(a) {};
      template&lt;typename Conv&gt; Gizmo(const Conv&amp; conv) : a_(static_cast&lt;A&gt;(conv)) {};
  
  private:
      A a_;
  };
  
  //
  // ERROR HERE:
  // " error C2039: 'Gizmo&lt;B&gt;' : is not a member of 'Gizmo&lt;A&gt;'"
  //
  template&lt;&gt; template&lt;typename B&gt; Gizmo&lt;string&gt;::Gizmo&lt;typename B&gt;(const B&amp; b)
  {
      stringstream ss;
      ss &lt;&lt; b;
      ss &gt;&gt; a_;
  }
  
  int main()
  {
      Gizmo&lt;int&gt; a_int;
      Gizmo&lt;int&gt; a_int2(123);
      Gizmo&lt;string&gt; a_f(546.0f);
  
      return 0;
  }
  </code></pre>