title: What to do with template typenames for optional arguments?
body: <p>First of all, the code:</p>
  
  <pre><code>template&lt;typename Func, typename Func2&gt;
  void ForEachField(Func normalHandler, Func2 arrayHandler = NULL, bool skipUnknowns = true)
  {
      for(int i = 0; i &lt; mFields.size(); ++i)
      {
          Field *f = mFields[i];
  
          if(skipUnknowns &amp;&amp; f-&gt;IsUnknown())
              continue;
  
          if(f-&gt;GetCount() == 1 || !arrayHandler)
              normalHandler(f);
          else
              arrayHandler(f);
      }
  }
  </code></pre>
  
  <p>And an example of usage:</p>
  
  <pre><code>df-&gt;ForEachField(
      [&amp;](Field *field) { f &lt;&lt; "\t" &lt;&lt; format("public $%s;\n") % field-&gt;GetName(); },
      [&amp;](Field *field) { f &lt;&lt; "\t" &lt;&lt; format("public $%s;\n") % field-&gt;GetName() % field-&gt;GetSize(); }
  ); // Works
  
  df-&gt;ForEachField(
      [&amp;](Field *field) { WriteLine(f, format("\t\t'%s' =&gt; array('type' =&gt; '%s'),") % field-&gt;GetName() % field-&gt;GetTypeInfo()-&gt;Name);
  }); // Doesn't work
  </code></pre>
  
  <p>The second call doesn't work because it says:</p>
  
  <blockquote>
    <p>OutputPhp.cpp(27): error C2783: 'void
    DataFile::ForEachField(Func,Func2,bool)'
    : could not deduce template argument
    for 'Func2'
              see declaration of 'DataFile::ForEachField'</p>
  </blockquote>
  
  <p>Is there any way I can make the second parameter optional, while still using templates, and while not having to manually specify the second template argument?</p>