Templates with strings

Philippe Sigaud philippe.sigaud at gmail.com
Sun Jul 4 02:59:47 PDT 2010


On Sun, Jul 4, 2010 at 09:34, Ali Çehreli <acehreli at yahoo.com> wrote:

> Mike Linford wrote:
>
> > 2. The reason I don't use CTFE is because I don't know how to be certain
> > its been called at compile time. Apparently using a result in a template
> > like you did will accomplish that, but is there a way I can be sure
> > without making up bogus empty templates?
>
> There is relatively detailed information on what types of functions can be
> called at compile time:
>
>  http://www.digitalmars.com/d/2.0/function.html#interpretation
>
> <quote>
> In order to be executed at compile time, the function must appear in a
> context where it must be so executed, for example:
>
>    * initialization of a static variable
>    * dimension of a static array
>    * argument for a template value parameter
> </quote>
>


And, traditionally, being defined as an enum (a C/C++ inheritance?)

enum thingy = funToBeTested();

If it compiles, then funToBeTested works at compile-time.

Is there not a __ctfe trait or somesuch?

Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100704/e1652cc0/attachment.html>


More information about the Digitalmars-d-learn mailing list