traceMixin

Wraps a string mixin and displays the string at compile-time. Useful for debugging.

Usage:

template defineFloat(string name)
{ enum defineFloat = "float "~name~";"; }
string defineInt(string name, string value)
{ return "int "~name~"="~value";"; }

mixin(traceMixin!("defineFloat!", `"myFloat"`));
mixin(traceMixin!("defineInt!", `"myInt", 5`));

Turns Into:

template defineFloat(string name)
{ enum defineFloat = "float "~name~";"; }
string defineInt(string name, string value)
{ return "int "~name~"="~value";"; }

float myFloat;
pragma(msg, "defineFloat:\n float myFloat;");
int myInt=5;
pragma(msg, "defineInt:\n int myInt=5;");

Compiler Output:

defineFloat:
float myFloat;
defineInt:
int myInt=5;
template traceMixin (
string name
string args
) {}

Members

Manifest constants

traceMixin
enum traceMixin;
Undocumented in source.

Meta