title: Trying to understand lambdas
body: <p>Trying to understand lambdas in C++, what I do not understand is this:</p>
  
  <pre><code>int multiplier = 5;
  auto timesFive = [multiplier](int a) { return a * multiplier; }; 
  std::cout &lt;&lt; timesFive(2) &lt;&lt; '\n'; // Prints 10
  
  multiplier = 15;
  std::cout &lt;&lt; timesFive(2) &lt;&lt; '\n'; // Still prints 2*5 == 10 (???) - Should it be 30?
  </code></pre>
  
  <p>When the program calls the <code>timesFive()</code> the second time, I expect the result to be 30. But why is the result <code>Still prints 2*5 == 10</code>, not <code>prints 2*15 == 30</code>? Perhaps the lambda function somehow cannot track the value of <code>multiplier</code>, even though we have already tried to capture it?</p>
  
  <p>And what is the way to get the desired result?</p>