4 ms·
So, with a clever use of a macro (and assuming you use reference-counted smart pointers or have another way of persisting variables at that time on the stack),
by angersock 15y ago
So, with a clever use of a macro (and assuming you use reference-counted smart pointers or have another way of persisting variables at that time on the stack), you can totally make a fire-and-forget closure in C++. Our solution involved declaring inline classes with some minor stringification magic to guarantee uniqueness.
- sixbrx 15y agoYep, there are some neat ways of emulating the capture, I didn't mean to imply it was impossible - just beyond what workaday programmers like me are willing to do :)