QUERY Lambda Expression "[this]" : StackOverflow

11 Views Asked by At

With regards to lambda expressions, what is the meaning of "[this]"?

I have rarely seen "[this]" and Google does not turn up any answers.

According to https://en.cppreference.com/w/cpp/language/lambda, it states [this] is a "simple by-reference capture of the current object".

Is the following line of code

mMap[ID] = [this] (){return Ptr(new T(*this, mContext));};

equivalent to

mMap[ID] = [&] (){return Ptr(new T(*this, mContext));};

?

Thank you.

0

There are 0 best solutions below