title: Template class methods with different arguments but same code
body: <p>I have created a template class that implements various DSP algorithms.  A problem that I have just started running into is that I want to implement the algorithms for both real and complex data, but that means that I have to implement the methods twice even though the bodies of the methods are exactly the same.  An example:</p>
  
  <pre><code>template &lt;class T&gt;
  class DspAlgorithms {
  public:
      DspAlgorithms();
      vector&lt;T&gt; Convolve(vector&lt;T&gt; signal, vector&lt;T&gt; filter);
      vector&lt; complex&lt;T&gt; &gt; Convolve(vector&lt; complex&lt;T&gt; &gt; signal, vector&lt;T&gt; filter);
  };
  </code></pre>
  
  <p>I see no way of not declaring and implementing the methods twice even though they have the exact same code inside.  Is there a clever way to avoid just copying and pasting the entire method implementation?</p>