%u <e...@ee.com> wrote:
though, supporting a non-continues range of values (which I don't need)
will be
annoying in this setup, I think..
Impossible in the current version, unless you accept having a bunch of
dummy fields. It is not hard to implement:
template defineStaticImpl( T, int value, string name ) {
// Do as below, no recursion.
}
template defineStaticImpl( T, int value, string name, string next, args...
) {
// Mostly as before.
}
template defineStaticImpl( T, int value, string name, int actualValue,
args... ) {
mixin defineStaticImpl!( T, actualValue, name, args );
}
> Won't the compiler even choke on the type size when feeding
defineEnum a
> hundred
> elements or so?
Types are limited to 64K of memory, I think. That should be enough for
16K
elements in this case. If you're thinking of the horribly long names,
I believe identifiers are hashed rather than being stored wholesale,
once
they move past 16K.
Good to know.
All this makes for a nice freachable D1 defineEnum, thanks!
My pleasure. Was a fun challenge.
--
Simen