If lambda function ic C++ is implemented by functor, why this is not possible?
#include <iostream>
class A
{
public:
int a;
void f1(){ [](){std::cout << this << std::endl ;}();};
};
int main()
{
A a;
a.f1();
}
I get error 9:34: error: 'this' was not captured for this lambda function. If I understand it right, if lambda is implemented as a functor class, why it is not possible to get it`s internal this?
EDIT: this of functor class, not this of instance of class A.
Aucun commentaire:
Enregistrer un commentaire