float CT stringification

Jarrett Billingsley kb3ctd2 at yahoo.com
Thu Jun 5 07:01:49 PDT 2008


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:g28fah$2i8d$1 at digitalmars.com...
> Metaprogramming in D is a really slow thing, there must be faster & 
> simpler ways.
> (I think there are simpler ways, using a scripting language to create D 
> code before the compilation. I have created a Python templating system 
> that seem to work well enough for C++).
>
> I have written the following code to test compile time optimization 
> regarding a small kernel convolution, the metaGenerated() is as fast as 
> the hand written version. I show it here because it may be interesting to 
> someone.
>
> But currently the metaGenerated() doesn't work if the kernel2 contains 
> floating point values. I think this problem can be solved with a compile 
> time function/template like ToString that works on floating point values 
> too, do you have it?

const f = 1.2345;
pragma(msg, f.stringof);


...




More information about the Digitalmars-d-learn mailing list