title: C++ Generic Abstract Factory Design Question
body: <p>I'm currently trying to design an generic Abstract Factory and have the following class design sketched out:</p>
  
  <pre><code>template &lt;typename T&gt;
  class TFactory
  {
      public:
          template &lt;typename A&gt;
          static T* create(A a);
  
          template &lt;typename A, typename B&gt;
          static T* create(A a, B b);
  
          template &lt;typename A, typename B, typename C&gt;
          static T* create(A a, B b, C c);
  
          static T* destory(T* ptr);
  };
  </code></pre>
  
  <p>The factory can then be used as so:</p>
  
  <pre><code>Factory&lt;MyType&gt;::create(1, "hello");
  Factory&lt;MyType&gt;::create&lt;short, const std::string&amp;&gt;(1, "hello");
  </code></pre>
  
  <p>Is there a better way to design this? This seems better than varargs but still has me overloading for up to 10 functions.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I should add the reason for this is that I will be using a custom memory allocator within the Factory.</p>