title: Lambda capture reference variable by reference
body: <p>For a lambda, I'd like to capture something by reference which was held in the outer scope by reference already. Assume that the referenced value outlives the lambda, but not the scope in which the lamdba gets created.</p>
  
  <p><a href="https://stackoverflow.com/q/6529177/592323">I know that</a> if a lambda captures a reference variable <em>by value</em>, the referenced object will be copied. I'd like to avoid this copy.</p>
  
  <p>But what happens if I capture a reference variable <em>by reference</em>? What if the original reference variable will get out of scope before executing the lambda? Is this safe? In other words: is the <em>object</em> behind the reference referenced or is the <em>reference variable</em> referenced in the lambda?</p>
  
  <pre><code>auto f() {
      const auto &amp; myRef = g();
      return [&amp;]{ myRef.doSomething(); };
  }
  
  f()();  // Safe?
  </code></pre>