Get template name

JS js.mdnq at gmail.com
Mon Jul 29 16:02:56 PDT 2013


__FUNCTION__ does not return anything when used in templates.

For debugging purposes I sometimes use pragma(msg, 
template_name); (with template_name being the name of the 
template assigned an enum)

I would like to make this more general such as

pragma(msg, mixin(__FUNCTION_NAME__));

e.g.,

template t()
{
     enum t = "asdf";
     pragma(msg, t);
}

same but more general

template t()
{
    enum t = "asdf";
    pragma(msg, __FUNCTION_NAME__);
}

(please don't ask why I would do this... this is a simple 
example, my case is more complex, trust me that I have a reason)



More information about the Digitalmars-d-learn mailing list