title: Why can lambdas be better optimized by the compiler than plain functions?
body: <p>In his book <code>The C++ Standard Library (Second Edition)</code> Nicolai Josuttis states that lambdas can be better optimized by the compiler than plain functions.</p>
  
  <blockquote>
    <p>In addition, C++ compilers optimize lambdas better than they do
    ordinary functions.
    (Page 213)</p>
  </blockquote>
  
  <p>Why is that? </p>
  
  <p>I thought when it comes to inlining there shouldn't be any difference any more. The only reason I could think of is that compilers might have a better local context with lambdas and such can make more assumptions and perform more optimizations. </p>