Get template name
evilrat
evilrat666 at gmail.com
Mon Jul 29 20:26:56 PDT 2013
On Monday, 29 July 2013 at 23:02:57 UTC, JS wrote:
> __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)
is this an option?
writeln("template name: ", t.stringof);
More information about the Digitalmars-d-learn
mailing list