Y
Hacker News
new
|
ask
|
show
|
jobs
by
noselasd
305 days ago
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.
1 comments
gf000
305 days ago
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.
link
If you do want it, you have the option to, say, heap allocate.