to!string(double) at compile time
timothee cour via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jan 1 23:01:58 PST 2016
On Thursday, 23 August 2012 at 13:56:05 UTC, Philippe Sigaud
wrote:
> On Tue, Aug 21, 2012 at 6:43 AM, Bobby Bingham
> <uhmmmm at gmail.com> wrote:
>>[...]
>
>> [...]
>
> A possibility is to use a function template, passing the double
> as a template argument:
>
> string test(double d)() // d is a template argument
> {
> return d.stringof;
> }
>
> enum testvar = mixin(test!(3.14));
>
> void main()
> {
> pragma(msg, testvar);
> }
https://issues.dlang.org/show_bug.cgi?id=15497
More information about the Digitalmars-d-learn
mailing list