use template function without assignment

JS js.mdnq at gmail.com
Mon Jul 29 16:09:19 PDT 2013


I have created a template Pragma that emulates pragma but better, 
the problem is that I have to assign it to something which is 
very redundant in my code:

enum temp = Pragma!(msg)

e.g.,

template Pragma(alias amsg)
{
     string Pragma(string file = __FILE__)
     {
         pragma(msg, amsg);
         return "";
     }
}

When I try to use void instead of string and do something like

Pragma!(msg)

I get an error that the template has no effect. It does have an 
effect but what it is complaining about is exactly what I want.

I've tried all kinds of combinations(mixins work but I then can't 
ise __FILE__) and nothing works. Maybe someone has an idea.







More information about the Digitalmars-d-learn mailing list