title: Inferred return type when passing function by template
body: <p>My question is about having the compiler infer the return type of a function based on the return type of a function passed by template.</p>
  
  <p>Is there some way I can call as</p>
  
  <pre><code>foo&lt;bar&gt;(7.3)
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>foo&lt;double, int, bar&gt;(7.3)
  </code></pre>
  
  <p>in this example:</p>
  
  <pre><code>#include &lt;cstdio&gt;
  template &lt;class T, class V, V (*func)(T)&gt;
  V foo(T t) { return func(t); }
  
  int bar(double j)  { return (int)(j + 1); }
  
  int main() {
    printf("%d\n", foo&lt;double, int, bar&gt;(7.3));
  }
  </code></pre>