how to detect ctfe

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 31 23:00:45 PDT 2014


Vlad Levenfeld:

> Is there any way that I can detect whether or not a function is 
> being evaluated at compile time? Specifically I want to switch 
> between to use/not to use memoize!func without having to figure 
> out when its CTFE-able and calling it with different syntax.

Calling it with a different syntax seems not easy to do. But 
there is a run-time variable __ctfe that can be used to 
disable/enable the memoization.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list