title: How to return a function type dependent on a template argument?
body: <p>I would like to return a <code>std::function</code> whose type is dependent on the type of one template argument of my function template.</p>
  
  <pre><code>// Return a function object whose type is directly dependent on F
  template&lt;typename F, typename Arg1, typename Arg2&gt;
  auto make_f2_call(Arg1&amp;&amp; arg1, Arg2&amp;&amp; arg2)
      -&gt; std::function&lt;--what-goes-here?--&gt;
  {
      return [arg1, arg2](F f) { return f(arg1, arg2); };
  }
  
  // Usage example, so that it's clearer what the function does:
  ...
  typedef bool (*MyFPtrT)(long id, std::string const&amp; name);
  bool testfn1(long id, std::string const&amp; name);
  ...
  auto c2 = make_f2_call&lt;MyFPtrT&gt;(i, n); // std::function&lt;bool(F)&gt;
  ...
  bool result = c2(&amp;testfn1);
  </code></pre>
  
  <p>Logically <code>--what-goes-here?--</code> should be the function signature of a function returning the return type of <code>F</code> and taking an argument of type <code>F</code> but I seem to be unable to tell my compiler (Visual Studio 2010 Express) this intent. (<strong>Take Note:</strong> In the usage example, it would be <code>std::function&lt;bool(F)&gt;</code>.)</p>
  
  <p>(Note: I have tried variations of <code>std::result_of&lt;F&gt;::type</code> without success.)</p>
  
  <p>Is this possible with C++0x?</p>