On Sat, Apr 11, 2009 at 10:11 PM, Doctor J <[email protected]> wrote: > grauzone Wrote: > >> What exactly are you trying to accomplish? >> >> It seems that you want to use the AA in CTFE, but it doesn't work, >> because using AAs with classes as keys don't work in CTFE? > > > Correct. At compile time, I want to build up an associative array mapping > type tuples to integers. Then, again at compile time, I want to query it.
Ooh. Without some serious trickery, I don't know if that's possible. The thing is, nothing at compile time can have any kind of persistent state - in effect, everything you use or do at compile time must be pure. Having some kind of compile-time registry of types built up as they register themselves, while useful, can't really be done easily. I've seen some persistent state kept by awful, awful means (i.e. conditionally testing for the existence of and declaring uniquely-named symbols in order to store some kind of info) but there is no general mechanism for it.
