title: Pass a function as an explicit template parameter
body: <p>In the code example below, the call to <code>foo</code> works, while the call to <code>bar</code> fails.</p>
  
  <p>If I comment out the call to <code>bar</code>, the code compiles, which tells me the definition of <code>bar</code> itself is fine. So how would <code>bar</code> be called correctly?</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int multiply(int x, int y)
  {
      return x * y;
  }
  
  template &lt;class F&gt;
  void foo(int x, int y, F f)
  {
      cout &lt;&lt; f(x, y) &lt;&lt; endl;
  }
  
  template &lt;class F&gt;
  void bar(int x, int y)
  {
      cout &lt;&lt; F(x, y) &lt;&lt; endl;
  }
  
  int main()
  {
      foo(3, 4, multiply); // works
      bar&lt;multiply&gt;(3, 4); // fails
  
      return 0;
  }
  </code></pre>