how to do this meta-programming? print the address of random element's address of a variable length of arrays?
Paul Backus
snarwin at gmail.com
Sat Sep 12 19:06:47 UTC 2020
On Saturday, 12 September 2020 at 18:16:51 UTC, mw wrote:
> Now, let me expand this challenge: suppose we need to add a new
> set of variable length extra parameters in parallel to the
> arrays, i.e:
>
> [...]
>
> Now the question is how to pass & handle 2 sets of variadic
> parameters?
void fun(Args...)(Args args)
if (args.length % 2 == 0)
{
alias firstSet = args[0 .. $/2];
alias secondSet = args[$/2 .. $];
// rest of function body goes here
}
You will probably also want to include some `static asserts` to
make sure each set contains arguments of the appropriate types.
More information about the Digitalmars-d-learn
mailing list