CTFE vs. traditional metaprogramming
language_fan
foo at bar.com.invalid
Sat Oct 10 13:29:26 PDT 2009
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. The range of a template
used as a metafunction is {types, values} and their mixture. CTFE
functions only return values. Understanding the concept of 'lambda cube'
will help you here.
More information about the Digitalmars-d
mailing list