Muistiinpano
Tälle sivulle pääsy edellyttää valtuutusta. Voit yrittää kirjautua sisään tai vaihtaa hakemistoja.
Tälle sivulle pääsy edellyttää valtuutusta. Voit yrittää vaihtaa hakemistoja.
'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
}