mardi 6 novembre 2018

In C++, capturing " *this " in lambda

struct S { 
    int x = 4;
    void f(int i); 
};

void S::f(int i) {
    [=, *this]{}; // OK: captures this by value. See below.
}

Why is the lambda [=, *this]{}; valid?

Aucun commentaire:

Enregistrer un commentaire