On Friday, 1 September 2017 at 20:58:20 UTC, EntangledQuanta wrote:

template(A, B...)
{
   auto foo(C...)(C c)
   {
       ... get c's parameter names, should be alpha, beta
   }
}


foo!(., .)(alpha, beta)

I need the actual identifiers passed to foo. I can get the types(obviously C) but when I try to get the identifier names(__traits(identifier or other methods) I stuff get _param_k or errors.

I need both C's types and the parameter identifier names past, else I'd just pass as strings.

Like Jonathan M Davis points out, this is impossible for regular parameters. For template alias parameters, on the other hand, this works:

void bar(alias fn)() {
    assert(fn.stringof == "alpha");
}

unittest {
    int alpha;
    bar!(alpha);
}

--
  Biotronic

Reply via email to