title: C++: Change variables captured in lambda from outside
body: <p>Is there any way to change the variable captured <em>by copy</em> in a lambda from the outside?</p>
  
  <p>Example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main() {
      int x = 3;
      auto f = [x]() { std::cout &lt;&lt; x &lt;&lt; std::endl; };
      // is there anything I can do here to make f print 4?
      f();
  }
  </code></pre>
  
  <p>If this is possible, it feels really dirty. Is there a compelling reason why I shouldn't even think about doing so?</p>