Template instantiation without (...)

Steve Teale steve.teale at britseyeview.com
Sun Feb 7 05:37:09 PST 2010


Which bit of the spec for template instantiation is it that allows the 
last two lines of the following to compile and work?

import std.stdio;


struct A
{
    int a;
}

template Thingie(T)
{
    static if (is(T == int))
        enum Thingie = 1;
    else
        enum Thingie = 0;
}

void main()
{
    writefln("%d", Thingie!(int));
    writefln("%d", Thingie!int);
    writefln("%d", Thingie!A);
}


More information about the Digitalmars-d-learn mailing list