title: Template type deduction with std::function
body: <p>I have discovered the following behaviour with <code>std::function</code> and type deduction, which was unexpected for me:</p>
  
  <pre><code>#include &lt;functional&gt;
  
  template &lt;typename T&gt;
  void stdfunc_test(std::function&lt;T(T)&gt; func) {};
  
  int test_func(int arg)
  {
      return arg + 2;
  }
  
  int main()
  {
      stdfunc_test([](int _) {return _ + 2;});
      stdfunc_test(test_func);
  }
  </code></pre>
  
  <p>Both lines in <code>main</code> result in error:</p>
  
  <blockquote>
    <p>no instance of function template "stdfunc_test" matches the argument list</p>
  </blockquote>
  
  <p>When attempting to compile in Visual Studio 2015.</p>
  
  <p>Why doesn't the type deduction deduct template type from the function type, and is there a workaround for it?</p>