Quick A: Because you can only capture local (stack) objects, including function parameters, and to access a data member in a member function you capture the local variable this
.
Today on SO:
Why can't a data member be in a lamba capture list
I have a class
foo
that hasbar
as a member variable.In another member function of the class, I'm writing a lambda function:
[bar](void){}But I can't include
bar
in the capture list. Why is that?
Add a Comment
Comments are closed.