Don <nos...@nospam.com> wrote:
Jonathan M Davis wrote:
This prints out void:
import std.stdio;
template isX(T)
{
enum val = true;
enum isX = val;
}
void main()
{
writeln(typeof(isX!(int)).stringof);
}
If you change it to
template isX(T)
{
enum val = true;
enum isX = true;
}
it still prints out void. If you get rid of val, it finally prints
bool. However, as I understood it, you should be able to declare
multiple enums within the same template and get this to work as long as
you just have the one with the same name as the template. Am I wrong
about that?
You're wrong about that.
Actually, according to TDPL, that is correct. "A template using the
eponymous trick may define other names inside, but those are simply
inaccessible from the outside." (page 281)
--
Simen