Equivalent of C++ #__VA_ARGS__

Adam D. Ruppe destructionator at gmail.com
Sun Aug 2 15:48:34 UTC 2020


On Sunday, 2 August 2020 at 15:30:27 UTC, Ronoroa wrote:
> How do I achieve equivalent semantics of following C++ code?
>
> ```
> #define dbg(...) std::cout << __LINE__ << #__VA_ARGS__ << " = " 
> << print_func(__VA_ARGS__) << std::endl;
> ```

You probably just want


void dbg(Args...)(Args args, size_t line = __LINE__) {
      writeln(line, args, " = ", print_func(args));
}


More information about the Digitalmars-d-learn mailing list