Content deleted Content added
Line 42:
The use of <code>const</code> tells the compiler that the initializer for the variables must be computed at compile time<ref>[http://www.digitalmars.com/d/1.0/attribute.html#const D 1.0 language specification: Attributes]</ref>.
CTFE can be used to populate simple data structures at compile-time in a simple way (D
<source lang="D">int[N] genFactorials(int N)() {
int[N] result;
result[i] =
return result;
}
enum auto factorials = genFactorials!(13)();
// Now 'factorials' contains at compile-time:
|