Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
'this' can only be used as a lambda capture within a non-static member function
Remarks
You cannot pass this to the capture list of a lambda expression that is declared in a static method or a global function.
To correct this error
Convert the enclosing function to a non-static method, or
Remove the
thispointer from the capture list of the lambda expression.
Example
The following example generates C3482:
// C3482.cpp
// compile with: /c
class C
{
public:
static void staticMethod()
{
[this] {}(); // C3482
}
};