More general Cartesian product
Magnus Lie Hetland
magnus at hetland.org
Wed Feb 29 06:51:24 PST 2012
On 2012-02-29 14:24:36 +0000, Philippe Sigaud said:
> [snip]
Thanks for the response.
In the meantime, I also hacked together a simple version of what I
needed (see below), but I'll look into the references you provided as
well :)
void forall(alias func, size_t lvl=0, T...)(T args) {
static if (lvl == args.length) {
func(args);
}
else {
foreach (e; args[lvl]) {
forall!(func, lvl+1)
(args[0..lvl], e, args[lvl+1..$]);
}
}
}
--
Magnus Lie Hetland
http://hetland.org
More information about the Digitalmars-d-learn
mailing list