language_fan wrote:
Sat, 10 Oct 2009 10:30:31 +0200, Don thusly wrote:

The more fundamental problem is that you can't
instantiate a template from inside CTFE. IE, you can cross from the
"compile-time world" to the "runtime world" only once -- you can never
get back.

That's not exactly true. Also both templates and CTFE are compile time features. You can compute a value with CTFE in the "value world" and lift the result to the "type world" with a template.

Yes, but the problem is that variables inside a CTFE function, even though they are known at compile-time, are not permitted to be used as template value parameters. For example:

template A(int X) { enum int A = B(X)+1; } // OK, template can call CTFE

int B(int X) { return A!(X) + 1; }
    // Not OK, CTFE cannot call template.





Reply via email to