how to do this meta-programming? print the address of random element's address of a variable length of arrays?
mingwu at gmail.com
Sun Sep 13 01:25:43 UTC 2020
On Saturday, 12 September 2020 at 20:29:40 UTC, Paul Backus wrote:
> 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
> 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.
I'm wrapping a C library, trying to write a single D function /
template that can work with a group of C functions, hence I need
that kind of signature I described.
I'll post the code when I'm ready.
More information about the Digitalmars-d-learn