Hacker News new | ask | show | jobs
by slavik81 1618 days 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.

1 comments

> 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.