title: omit template parameter (for function pointer argument)
body: <p>I'm writing template factory that stores function pointer to create user objects.<br>
  I would like to support user Creation function with and without argument (for now, one or zero argument will do). 
  (and i can't use boost or c11 unfortunately )</p>
  
  <pre><code>template&lt; typename T, typename K, typename D &gt;
  //T (Type) is a polymorphic type
  //K (Key) should have operator &lt; and be copyable
  //D (Data argument for creator function) can be copyable
  class Factory
  {
  public:
      typedef std::tr1::shared_ptr&lt;T&gt; shared_ptr;
      //auto gen Ctor and Dtor
  
      inline void Add( const K&amp; key_, T* (*CreatorFunc)(D) );
      inline shared_ptr Create(const K&amp; key_, const D&amp; initData_ ) const;
  
  private:
      std::map&lt;K, T* (*)(D) &gt; m_creator;
  };
  </code></pre>
  
  <p>I would love it if the user can use it like this:</p>
  
  <pre><code>class c1
  {
  public:
      explicit c1(const string&amp; st);
      ...
  };
  
  class c2
  {
  public:
      explicit c2();
      ...
  };
  
  c1* CreateC1(const string&amp; st){ return new c1(st);}
  c2* CreateC2(){ return new c2;}
  
  ...
  //Factory&lt;type, key, arguments&gt;
  Factory&lt;c1, int, string&gt; f;
  f.Add(0, CreateC1);
  f.Create(0, "string Arg");
  
  //Factory&lt;type, key&gt;
  Factory&lt;c2, int&gt; f2;
  f2.Add(0, CreateC2);
  f2.Create(0);
  </code></pre>
  
  <p>i did manage to get this to work with some ugly template specialization. i feel like i'm going at it the wrong way. </p>
  
  <p>my solution:</p>
  
  <pre><code>class EmptyClass {};
  template&lt; typename T, typename K, typename D = EmptyClass&gt;
  class Factory
  {
  public:
      typedef std::tr1::shared_ptr&lt;T&gt; shared_ptr;
  
      inline void Add( const K&amp; key_, T* (*CreatorFunc)(D) );
      inline shared_ptr Create(const K&amp; key_, const D&amp; initData_ ) const;
  
  private:
      std::map&lt;K, T* (*)(D) &gt; m_creator;
  };
  
  template&lt;&gt;
  template&lt; typename T, typename K &gt;
  class Factory&lt;T, K, EmptyClass &gt;
  {
  public:
      typedef std::tr1::shared_ptr&lt;T&gt; shared_ptr;
  
      inline void Add( const K&amp; key_, T* (*CreatorFunc)() );
      inline shared_ptr Create(const K&amp; key_) const;
  private:
      std::map&lt;K, T* (*)() &gt; m_creator;
  };
  </code></pre>
  
  <p>feel free to criticize anything else if you wany</p>