Lambda captures (C++)

Setup lambda

auto func = [/*capures*/](/*arguments*/){/*body*/};

Specify captures

 <var> ... Local variable by value
&<var> ... Local variable by reference
   =   ... All local variable by value
   &   ... All local variable by reference
 this  ... Member variables via this pointer
  • Capture a pointer: Just pass it by value, not by reference.
  • Capture a field: Create a ref/ptr onto it and pass that.