Let's get the semantic around closure fixed.
Ola Fosheim Grostad
ola.fosheim.grostad at gmail.com
Tue May 18 21:11:08 UTC 2021
On Tuesday, 18 May 2021 at 20:26:26 UTC, Steven Schveighoffer
wrote:
> On 5/18/21 4:07 PM, Ola Fosheim Grostad wrote:
> No, it was correct before the hack. Code which captured a
> struct that would be destroyed outside the scope just wouldn't
> compile. Now it does.
Btw in C++ lambdas should not outlive captured references, if you
want that you need to make a copy, aka capture by value. That is
a clean solution to the destructor problem as the destructor will
be called when you expect it to.
I guess that is the only sensible solution.
More information about the Digitalmars-d
mailing list