how to do this meta-programming? print the address of random element's address of a variable length of arrays?
mw
mingwu at gmail.com
Sat Sep 12 19:31:57 UTC 2020
On Saturday, 12 September 2020 at 19:06:47 UTC, Paul Backus wrote:
> 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?
>
> alias firstSet = args[0 .. $/2];
> alias secondSet = args[$/2 .. $];
This solution assumes the two sets are of equal size; what if we
don't have such assumption? i.e. we only know the two sets
divided into two logical groups.
I've tried something like this: the AliasSeq specify the logical
divide
printRandomElemAddr(AliasSeq!(extraA, extraB, extraC, extraD),
a, b, c);
but cannot make it work.
(I'm asking for a more general solution, e.g. what if we have 3,
or N sets of variadic parameters?)
Looks like we can only pass 1 variadic parameters, then the
question is what's the best way to divide it?
Is there any special marker (variable or type?) can be used to
divide? and what's the staticSplit?
More information about the Digitalmars-d-learn
mailing list