Indexing an associative array with a list of types

Doctor J nobody at nowhere.com
Sat Apr 11 17:58:49 PDT 2009


Hmm, not quite.

This works at runtime, but not at compile-time; I can't use classes at compile time:

    http://www.digitalmars.com/d/2.0/function.html#interpretation

and TypeInfo is a class:

    http://www.digitalmars.com/d/2.0/phobos/object.html#TypeInfo

Basically, what I want to do is assign a unique integer ID to each combination of type parameters of a template.  Aside from that, I'm having a heck of a time just building an associative array at compile time.  From the link above, to make CTFE work, it sounds like you basically can't reference any (non-constant) state; is that the case?  So, for example, if I wanted to keep a list of all compiled-in modules that (call a compile-time function to) register with the mothership, I'm out of luck?




More information about the Digitalmars-d-learn mailing list