title: Why does C++11's lambda require "mutable" keyword for capture-by-value, by default?
body: <p>Short example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main()
  {
      int n;
      [&amp;](){n = 10;}();             // OK
      [=]() mutable {n = 20;}();    // OK
      // [=](){n = 10;}();          // Error: a by-value capture cannot be modified in a non-mutable lambda
      std::cout &lt;&lt; n &lt;&lt; "\n";       // "10"
  }
  </code></pre>
  
  <p>The question: Why do we need the <code>mutable</code> keyword? It's quite different from traditional parameter passing to named functions. What's the rationale behind?</p>
  
  <p>I was under the impression that the whole point of capture-by-value is to allow the user to change the temporary -- otherwise I'm almost always better off using capture-by-reference, aren't I?</p>
  
  <p>Any enlightenments?</p>
  
  <p>(I'm using MSVC2010 by the way. AFAIK this should be standard)</p>