Parallel foreach over AliasSec?
Bastiaan Veelo via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Feb 26 23:37:37 PST 2017
On Monday, 27 February 2017 at 02:02:57 UTC, ag0aep6g wrote:
> Make a range or an array of function pointers from the AliasSeq
> of function aliases:
>
> ----
> import std.meta: staticMap;
> import std.range: only;
>
> enum fptr(alias f) = &f;
> enum fptrs = staticMap!(fptr, funcs);
> auto r = only(fptrs);
>
> foreach (i, f; parallel(r))
> values[i] = f(val);
> ----
Wow. Thank you!
More information about the Digitalmars-d-learn
mailing list