Er… it makes no difference?
Your first version is in fact a worse way to write the second one.
Your first version is in fact a worse way to write the second one.
What's even the point of capturing the variable itself? To allow for writing inline callbacks that could sneakily mutate loop-local variables?
That’s how you’d do it using a [=] lambda in c++ or a move closure in rust.