Lambda

LambdaExpression.JPG

  • [] – Capture nothing.
  • [=] – Capture everything by value.
  • [&] – Capture everything by reference.
  • [var] – Capture var by value; nothing else, in either mode, is captured.
  • [&var] – Capture var by reference; nothing else, in either mode, is captured.
  • [&,var] – Capture all by reference, except var, which is by value.
  • [=, &var] – Capture all by value, except var, which is by reference.
  • [var1, var2] – Capture var1, var2 by value.
  • [&var1, &var2] – Capture var1, var2 by reference.
  • [var1, &var2] – Capture var1 by value, var2 by reference.

some useful tips (mostly for myself)