xxxxxxxxxx
struct CallerFile
{
string file;
alias file this;
this(string file)
{
this.file = file;
}
auto format(int line)
{
import std.format : format;
return format!"%s:%d"(file, line);
}
}
void foo(string msg, CallerFile caller = __FILE__, int line = __LINE__)
{
import std.stdio;
writeln(caller.format(line));
}
void main()
{
foo("");
}