Johannes Pfau:
it should be possible to do this:
---------------
template X(T)
{
enum X
{
bitsPerT = T.sizeof * 8,
}
}
That seems correct, this works:
template Foo(T) {
enum Foo {
bitsPerT = T.sizeof * 8,
}
}
void main() {
pragma(msg, Foo!int.bitsPerT);
}
So if template Foo(T){enum Foo{}} works, then I think it should
also work the enum Foo(T){} syntax.
So far I don't think I have had to use templated enums, but if
other people have such need, than this thread and this post have
enough material for a little enhancement request.
Bye,
bearophile