You capture class members by saying this
in the capture list. This has nothing to do with the fact that the member is const
.
Example:
#include
struct Foo
{
const int a = 0;
int b;
Foo() : b{42} {
auto f = [this]() { std::cout << a << " " << b << std::endl; };
// ^^^^
f();
}
};
int main() {
Foo x;
}