title: Passing function as argument with template return value
body: <p>I have some c++ function that looks like follows:</p>
  
  <pre><code>template&lt;class T&gt; bool function(QString *text, T number, T (*f)(QString, bool)){
      bool ok = true;
      QString c = "hello";
      T col = (*f)(c, &amp;ok);
      // do something with col here ...
      return true;
   }
  </code></pre>
  
  <p>I am calling it from outside in following manner</p>
  
  <pre><code>double num = 0.45;
  double (*fn)(QString, bool) = &amp;doubleFromString;
  function(&amp;text, num, fn);
  </code></pre>
  
  <p>and (Edited)</p>
  
  <pre><code>unsigned int num = 5;
  int (*fn)(QString, bool) = &amp;intFromString;
  function(&amp;text, num, fn);
  </code></pre>
  
  <p>And I get error</p>
  
  <pre><code>template parameter T is ambigious
  </code></pre>
  
  <p>I guess that problem is in combining template and passing function as argument, but I am not sure how to figure that out. (I don't want to write the function twice just with different types). Any solution? </p>