On Monday, 2 November 2015 at 09:54:50 UTC, John Colvin wrote:
Works for me on multiple compilers. To be precise, this worked:
template show(Args...)
{
void show(string file = __FILE__, uint line = __LINE__,
string fun = __FUNCTION__)()
{
import std.stdio: write, writeln;
try
{
debug write(file, ":",line, ":" /* , ": in ",fun
*/, " debug: ");
foreach (const i, Arg; Args)
{
if (i) debug write(", "); // separator
debug write(Arg.stringof, " is ", Arg);
}
debug writeln();
}
catch (Exception) { }
}
}
unittest
{
int x = 11;
show!x;
}
No. This prints:
Arg is 11
I want it to print the name of Arg in the closing as
x is 11
equivalent to what my single-parameter overload
void show(alias arg, string file = __FILE__, uint line =
__LINE__, string fun = __FUNCTION__)()
{
import std.stdio: writeln;
try
{
debug writeln(file, ":",line, ":" /* , ": in ",fun */, "
debug: ", arg.stringof, " is ", arg);
}
catch (Exception) { }
}
does.