Memoization in compile-time
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Mar 13 11:05:24 PDT 2015
On 03/13/2015 06:16 AM, weaselcat wrote:
> confusingly, D uses enum for named compile-time constants.
> http://ddili.org/ders/d.en/enum.html
Actually, 'static' works as well. I have enumerated the cases here:
http://ddili.org/ders/d.en/functions_more.html#ix_functions_more.CTFE
<quote>
For a function to be executed at compile time, it must appear in an
expression that in fact is needed at compile time:
- Initializing a static variable
- Initializing an enum variable
- Calculating the length of a fixed-length array
- Calculating a template value argument
</quote>
Are there other cases that is worth adding to that list?
Ali
More information about the Digitalmars-d-learn
mailing list