title: Why can't I capture this by-reference ('&this') in lambda?
body: <p>I understand the correct way to capture <code>this</code> (to modify object properties) in a lambda is as follows:</p>
  
  <pre><code>auto f = [this] () { /* ... */ };
  </code></pre>
  
  <p>But I'm curious as to the following peculiarity I've seen:</p>
  
  <pre><code>class C {
      public:
          void foo() {
              // auto f = [] () { // this not captured
              auto f = [&amp;] () { // why does this work?
              // auto f = [&amp;this] () { // Expected ',' before 'this'
              // auto f = [this] () { // works as expected
                  x = 5;
              };
              f();
          }
  
      private:
          int x;
  };
  </code></pre>
  
  <p>The oddity that I am confused by (and would like answered) is why the following works:</p>
  
  <pre><code>auto f = [&amp;] () { /* ... */ }; // capture everything by reference
  </code></pre>
  
  <p>And why I cannot explicitly capture <code>this</code> by reference:</p>
  
  <pre><code>auto f = [&amp;this] () { /* ... */ }; // a compiler error as seen above.
  </code></pre>