title: Use decltype and std::function with lambda
body: <p>This works ...</p>
  
  <pre><code>auto x = 4;
  typedef decltype(x) x_t;
  x_t y = 5;
  </code></pre>
  
  <p>... so why doesn't this?</p>
  
  <pre><code>int j = 4;  
  auto func = [&amp;] (int i) { cout &lt;&lt; "Hello: i=" &lt;&lt; i &lt;&lt; "  j=" &lt;&lt; j &lt;&lt; endl;};
  typedef decltype(func) lambda_t;
  lambda_t func2 = [&amp;] (int i) { cout &lt;&lt; "Bye: i=" &lt;&lt; i &lt;&lt; "  j=" &lt;&lt; j &lt;&lt; endl;};
  </code></pre>
  
  <p>... and how would I declare <code>lambda_t</code> manually using std::function? </p>