title: C++: instantiate a templated class according to an argument
body: <p>I often find the need to use the following pattern:</p>
  
  <pre><code>template&lt;typename T&gt;
  class SomeClass : public Base {
     SomeClass(const T&amp; t) {...}
     ...
  };
  template&lt;typename T&gt;
  SomeClass&lt;T&gt;* makeSomeClass(const T&amp; t) {
     return new SomeClass&lt;T&gt;(t);
  }
  </code></pre>
  
  <p>And to use it:</p>
  
  <pre><code>Base* = makeSomeClass(123);
  </code></pre>
  
  <p>This is useful when I don't want to explicitly specify <code>T</code> because it is a very complex (function types, etc') and the function argument can deduce the type implicitly.<br>
  Is there a way to do this without the extra "make" function? Why does template deduction work only in function arguments and not in constructor arguments?</p>