2 ms·
I dunno this capture stuff is alright but also a bit like blatant appeasement. The point of this feature is to be non-cannonical RAII. I.e. it is about cleanin
by Ericson2314 5y ago
I dunno this capture stuff is alright but also a bit like blatant appeasement.
The point of this feature is to be non-cannonical RAII. I.e. it is about cleaning up a location. This data oriented approach is similar to how "locked data" is more correct and intuitive than "critical sections".
Now I get C being low level, so perhaps this is better, but I can't really imagine the thing I am cleaning up (as opposed to auxiliary info like an allocator to deallocate memory with) being captured by value.
BTW, speaking of moves, a "set this bool if I use this variable by value" feature would be very useful. Skip C++'s mistake and do Rust's model. Would work great with this feature.
- lelanthran 5y ago> Now I get C being low level, so perhaps this is better, but I can't really imagine the thing I am cleaning up (as opposed to auxiliary info like an allocator to deallocate memory with) being captured by value. I was wondering the same thing; what is the use-case for needing a capture-by-value option at scope exit? Just make all captures a capture-by-reference and it works for all use-cases.