The future of foreach| arbitrary number of arrays version
bearophile
bearophileHUGS at lycos.com
Sun Dec 23 07:24:00 PST 2007
bearophile:
> but it has a bug still, the index i gives problems still (in your original 2-element solution too, I think). If you want you can fix the problem.
Fixed, instead of size_t id, ref size_t:
mixin("
int opApply(int delegate(ref size_t, " ~ SeriesGen1S!("ref T%s", ", ", TyArrays.length-1) ~ ") dg) {
foreach (size_t id, entry; a0[0 .. len])" ~
"if (auto res = dg(id, entry, "~ SeriesGen1S!("a%s[id]", ", ", TyArrays.length-1, 1) ~ "))
return res;
return 0;
}
");
Bye,
bearophile
More information about the Digitalmars-d
mailing list