Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
'var': a lambda capture must have automatic storage duration
Remarks
You cannot capture a variable that does not have automatic storage duration, such as a variable that is marked static or extern.
To correct this error
- Do not pass a
staticorexternvariable to the capture list of the lambda expression.
Example
The following example generates C3495 because the static variable n appears in the capture list of a lambda expression:
// C3495.cpp
int main()
{
static int n = 66;
[&n]() { return n; }(); // C3495
}