No, (in C++) the lambda can capture the the variable by value, and the lambda itself can be passed around by value. If you capture a variable by reference or pointer that your lambda outlives, your code got a serious bug.
And in Rust, it will enforce correct usage via the borrow checker - the outlive case simply will not compile.
If you do want it, you have the option to, say, heap allocate.
And in Rust, it will enforce correct usage via the borrow checker - the outlive case simply will not compile.
If you do want it, you have the option to, say, heap allocate.