std.metastrings.ToString! problems

Ary Borenszweig ary at esperanto.org.ar
Fri Jul 24 13:01:37 PDT 2009


asd wrote:
>>>> n < 0L is not constant or does not evaluate to a bool
>>>> (D2, OS X)
>>>>
>>> That's because n isn't a compile-time constant.  You can't instantiate
>>> a template with runtime variables.
>>>
>> that includes "runtime variables" used in CTFE (this is because CTFE functions 
>> are also normal runtime functions).
> 
> In this case value of n is possible to know at compile time - it depends only on compile-time input.
> 
> I'm not going to use this function at run time. Too bad I can't declare that :(
> 

So write:

const int n = 0;



More information about the Digitalmars-d mailing list