Can a call to pragma(msg, __FILE__, ...) be mixin templatized?
Per Nordlöw
per.nordlow at gmail.com
Tue Aug 18 08:03:04 UTC 2020
On Monday, 17 August 2020 at 22:37:12 UTC, Simen Kjærås wrote:
> mixin template ctLog(string msg, string file = __FILE__, size_t
> line = __LINE__) {
> pragma(msg, file, "(", line, "): ", msg);
> }
Thanks.
Forgot to mention that I want to support variadic arguments to
`ctLog` similar to what is done with
void dbg(Args...)(Args args,
const string file = __FILE_FULL_PATH__,
const uint line = __LINE__,
const string fun = __FUNCTION__) @safe pure
nothrow @nogc
{
import std.stdio : stderr, writeln;
try
debug stderr.writeln(file, "(", line, ",1):", " Debug:
\"", args, "\"");
catch (Exception) { }
}
Is this possible?
More information about the Digitalmars-d-learn
mailing list