On Sunday, 2 August 2020 at 15:48:34 UTC, Adam D. Ruppe wrote:
On Sunday, 2 August 2020 at 15:30:27 UTC, Ronoroa wrote:
void dbg(Args...)(Args args, size_t line = __LINE__) {
     writeln(line, args, " = ", print_func(args));
}
That doesn't seem to stringize the args part like in #__VA_ARGS__

I've tried

void dbg(Args...)(Args args, size_t line = __LINE__) {
    writeln("#", line, ":", args, " = ");
    // print_func is simply writeln
    writeln(args);
}

void main() {
    int a = 10, b = 4;
    // gives #11 : 104 = 104
    // what I crucially want #9 : a, b = 10, 4
    //                            ^^^^ this
    dbg(a, b);
}


Reply via email to