forcing compile time function execution

Piotr Szturmaj bncrbme at jadamspam.pl
Tue Dec 27 10:26:28 PST 2011


Artur Skawina wrote:
> Is there a way to *force* CTFE? Without using an extra wrapper like this:
>
> auto f_impl(alias a)() { / * ... ctfeable ... */ }
> auto f(alias a)() { enum ctfed = f_impl!a; return ctfed; }
>
> A "@compile" (or "@ctfe" etc) function attribute would eliminate the need for the wrapper...
>
> artur

static x = functionToBeCTFEd();

PS. You should ask questions in D.learn :-)


More information about the Digitalmars-d mailing list