title: I want to choose the overloaded function by a template class's type, by way of storing the type in a member. Can I do this?
body: <p>I have a working example here:</p>
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;QString&gt;
  #include &lt;QUrl&gt;
  class Foobar
  {
      explicit Foobar( QString fun ) { }
  };
  
  template&lt;typename T&gt;
  class QPizza
  {
  public:
      explicit QPizza() { }
      QString value   () { return this-&gt;topping(m_T); }
  
  protected:
  
      virtual QString topping(T*)
      {
          return &quot;this is a T&quot;;
      }
      virtual QString topping(QString*)
      {
          return &quot;this is a qstring&quot;;
      }
      virtual QString topping(QUrl   *)
      {
          return &quot;This is a url&quot;;
      }
      virtual QString topping(Foobar *)
      {
          return &quot;This is a foobar&quot;;
      }
  private:
      T *m_T{nullptr};
  };
  </code></pre>
  <p>This allows me to execute the following code:</p>
  <pre class="lang-cpp prettyprint-override"><code>qDebug() &lt;&lt; QPizza&lt;QString&gt;().value() &lt;&lt; QPizza&lt;Foobar&gt;().value() ;
  // &quot;this is a qstring&quot; &quot;This is a foobar&quot;
  </code></pre>
  <p>This is great, in that it allows me to basically do specialization without any cumbersome  template syntax.</p>
  <p>Here is the problem:</p>
  <pre class="lang-cpp prettyprint-override"><code>    QString topping(QString ) // I'd rather have this
      QString topping(QString*) // instead of this because
      QPizza&lt;QString&gt;().value() // I want &lt;QString&gt; to be synonymous with (QString ), not (QString*)
  </code></pre>
  <p>However if I change <code>T *m_T{nullptr}</code> to <code>T m_T;</code>, then <code>QPizza&lt;Foobar&gt;()</code> ceases to work, because it's constructor requires an argument neccessarily.</p>
  <p>Is there any way to achieve my goal, so that if I or anyone else chooses to subclass, that the process of overloading <code>QString topping( &lt;SomeType&gt; );</code> is a little bit more straight forward?</p>
  <p>Thanks.</p>