title: Code duplication between typedefs and explicit instantiations
body: <p>tree.h</p>
  
  <pre><code>template&lt;typename Functor, char Operator&gt;
  class binary_operation : public node
  {
  // ... unimportant details ...
  
      unsigned evaluate() const;
      void print(std::ostream&amp; os) const;
  };
  
  typedef binary_operation&lt;std::plus&lt;unsigned&gt;, '+'&gt; addition;
  typedef binary_operation&lt;std::multiplies&lt;unsigned&gt;, '*'&gt; multiplication;
  // ...
  </code></pre>
  
  <p>tree.cpp</p>
  
  <pre><code>template&lt;typename Functor, char Operator&gt;
  unsigned binary_operation&lt;Functor, Operator&gt;::evaluate() const
  {
      // ... unimportant details ...
  }
  
  template&lt;typename Functor, char Operator&gt;
  void binary_operation&lt;Functor, Operator&gt;::print(std::ostream&amp; os) const
  {
      // ... unimportant details ...
  }
  
  template class binary_operation&lt;std::plus&lt;unsigned&gt;, '+'&gt;;
  template class binary_operation&lt;std::multiplies&lt;unsigned&gt;, '*'&gt;;
  // ...
  </code></pre>
  
  <p>As you can see, there is some code duplication between the typedefs in the header file and the explicit class template instantiations in the implementation file. Is there some way to get rid of the duplication that does not require putting "everything" in the header file as usual?</p>