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 20:29:40 UTC 2020
On Saturday, 12 September 2020 at 19:31:57 UTC, mw wrote:
>
> (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?
It's possible, but there's no widely-used technique, because it's
much easier to simply pass each "parameter set" as a separate
array or tuple. So your function signature would look like:
auto fun(Set1, Set2, Set3)(Set1 args1, Set2 args2, Set3 args3)
if (allSatisfy!(Or!(isArray, isTuple), Set1, Set2, Set3))
Or in the variadic case:
auto fun(Args...)(Args args)
if (allSatisfy!(Or!(isArray, isTuple), Args))
If you have a "real-life" application in mind for this, I'd be
curious to hear what it is.
More information about the Digitalmars-d-learn
mailing list