A lambda can only capture local variables. When a lambda is defined within a member function, you may believe that you are capturing a member variable of the current class, but in fact, what you are capturing is ``++this++``. This may be very surprising, and lead to bugs if the lambda is then used after the current object has been destroyed.
Therefore, it's better to be explicit about exactly what is captured as soon as ``++this++`` is captured.
If the lambda is used immediately (for instance, called or passed as an argument to ``++std::sort++``), there is no such risk and no issue is raised.
In {cpp}20, capturing ``++this++`` via [=] has been deprecated. An issue is raised in that case, even if the lambda is used immediately.
Note: This rule does not apply if the capture list of the lambda contains ``++*this++`` (possible since {cpp}17). In that situation, what is captured is not the pointer ``++this++``, but a local copy of the object pointed-to by ``++this++`` and any reference to ``++this++`` (explicit or implicit) in the lambda body then refers to this local copy (see S6016).
* https://github.com/isocpp/CppCoreGuidelines/blob/036324/CppCoreGuidelines.md#f54-if-you-capture-this-capture-all-variables-explicitly-no-default-capture[{cpp} Core Guidelines F.54] - If you capture ``++this++``, capture all variables explicitly (no default capture)