Templates and expressions

renoX renosky at free.fr
Sun Feb 25 13:15:53 PST 2007


Hello,

I've made a template to have a better (in my mind) format for printing, 
so like writef the template take a tuple of argument as a parameter, it 
works well when the parameter are variable but my problem is that if an 
argument of the template is an expression, there is a compilation time 
failure..

Ie putf!(x+y) fails to compile..

If I change the prototype to wrap everything in a string, the problem 
now is that as everything is a string I loose access to the type of the 
parameters, which I use..

Is-there a way to solve this problem?

Meta-programming in D will stay quite limited if you're obliged to wrap 
every expression in a string IMHO..

renoX


More information about the Digitalmars-d-learn mailing list