If I need to generate a lambda that calls a member function, should I capture by reference or capture \'this\'? My understanding is that \'&\' captures only the variable
Here is a good explanation of what &
, this
and the others indicate when used in the capture list.
In your case, assuming that all what you have to do is calling a member function of the instance that is actually referenced by the this
of the method that is currently executing, put this
in your capture list should be enough.