Comment #0 by iamthewilsonator — 2018-10-05T06:55:35Z
See https://forum.dlang.org/post/[email protected] for the motivation.
struct that contain destructors cannot be closed over (I'm not sure why but thats a different problem) and so
CantCloseMe o; // some struct with a door
somerange.each!(e => foo(o,e)); //Error: variable `o` has scoped destruction, cannot build closure
fails. But it can't be worked around with
somerange.each!((e,f) => foo(o,f))(o);
Fails with
Error: template somerange.each!((e,f) => foo(o,f)).each cannot deduce function from argument types !()(SomeRange, CantCloseMe), candidates are:
...
because all of the each functions take only a range or iterable.
Comment #1 by robert.schadek — 2024-12-01T16:34:16Z