title: C++11 variadic std::function parameter
body: <p>A function named <code>test</code> takes <code>std::function&lt;&gt;</code> as its parameter.</p>
  <pre><code>template&lt;typename R, typename ...A&gt;
  void test(std::function&lt;R(A...)&gt; f)
  {
      // ...
  }
  </code></pre>
  <p>But, if I do the following:</p>
  <pre><code>void foo(int n) { /* ... */ }
  
  // ...
  
  test(foo);
  </code></pre>
  <p>Compiler(gcc 4.6.1) says <code>no matching function for call to test(void (&amp;)(int))</code>.</p>
  <p>To make the last line <code>test(foo)</code> compiles and works properly, how can I modify the <code>test()</code> function? In <code>test()</code> function, I need <code>f</code> with type of <code>std::function&lt;&gt;</code>.</p>
  <p>I mean, is there any template tricks to let compiler determine the signature of function(<code>foo</code> in example), and convert it to <code>std::function&lt;void(int)&gt;</code> automatically?</p>
  <h3>EDIT</h3>
  <p>I want to make this work for lambdas(both stated and stateless) as well.</p>