On Sun, Jul 4, 2010 at 09:34, Ali Çehreli <acehreli@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