On Thu, 29 Oct 2009 19:32:56 -0500, Phil Deets <pjdee...@gmail.com> wrote:
enum Tag
{
A, B, C,
version (5) {
D, E,
}
version (7) {
F, G,
}
// ...
}
Thanks to Daniel Keep on the learn newsgroup, I got a workaround working.
template Version(string symbol) {
mixin("version("~symbol~") immutable Version = true;"~
" else immutable Version = false;");
}
mixin(q"ENUM
enum Tag
{
A, B,
ENUM"~(Version!("symbol")?q"ENUM
C, D,
ENUM":"")~q"ENUM
E,
}
ENUM");
That's not pretty, but it's good enough for me; so I'll probably not do
any compiler hacking.