title: c++ template partial specialization
body: <p>this might be question that someone asked before but i can't find it...</p>
  
  <p>i have a class in a <code>.hpp</code> file :</p>
  
  <pre><code>class A{
      public:
          A(){//constructor}
          ~A(){//destructor}
          //some public methods and arguments
  
          template&lt;typename Type&gt;
              void func(Type t){//do something for numbers}
  
      private:
          //some private methods and arguments
  }
  </code></pre>
  
  <p>The template method should work for int, double... but not for string. Thus in my <code>.hpp</code> file, I defined what <code>func</code> does for numbers and in my <code>.cpp</code> file I wrote :</p>
  
  <pre><code>template&lt;&gt;
  void A::func(std::string t){ // do something in that case}
  </code></pre>
  
  <p>But when I use the function <code>func</code> with <code>std::string</code>, the program calls the methods for numbers... So I replaced the <code>.hpp</code> file by :</p>
  
  <pre><code>class A{
      public:
          A(){//constructor}
          ~A(){//destructor}
          //some public methods and arguments
  
          template&lt;typename Type&gt;
              void func(Type t){//do something for numbers}
          void func(std::string s);
  
      private:
          //some private methods and arguments
  }
  </code></pre>
  
  <p>and my <code>.cpp</code> file became :</p>
  
  <pre><code>void A::func(std::string t){ // do something in that case}
  </code></pre>
  
  <p>and then everything works !</p>
  
  <p>my question is, is this the correct way to do that ?</p>