4 ms·
If your lambda doesn't capture any variables, it can be converted to a function pointer. You can also just capture by value, rather than by reference. If you r
by slavik81 5y ago
If your lambda doesn't capture any variables, it can be converted to a function pointer.
You can also just capture by value, rather than by reference. If you really want, there's also reference counting with shared_ptr.
- jhgb 5y ago> You can also just capture by value, rather than by reference. Those things are misnomers anyway. Having access to an enclosing environment via a free variable in a lambda expression is completely orthogonal to values vs. references. I suspect they should have named the whole thing differently.