@nogc closures
Paul Backus
snarwin at gmail.com
Sun Aug 5 17:11:46 UTC 2018
On Sunday, 5 August 2018 at 12:23:17 UTC, vit wrote:
> Yes, it isn't possible.
> I modify filter a and map from std.algorithm:
>
> void main()@nogc{
> import std.experimental.all;
> const int j = 2;
> int i = 0;
> const int[3] tmp = [1, 2, 3];
> tmp[]
> .xfilter!((x, j) => x == j)(j)
> .xmap!((x, j) => x * j)(j)
> .each!((x) => i = x);
> }
>
> full code: https://dpaste.dzfl.pl/15664d6da5c8
You can do it without modifying existing functions if you use
`zip`:
https://run.dlang.io/is/IKUvEf
More information about the Digitalmars-d-learn
mailing list