template alias parameters

enuhtac enuhtac_lists at gmx.de
Wed Apr 6 08:44:15 PDT 2011


Hi,

I'm playing around with template alias parameters. At the moment I'm
considering the following simple code:

struct A
{};

struct B( T )
{
    T t;
};

struct C( alias T )
{
    T t;
};

void main()
{
    B!A a;
    C!A b;
}

What exactly is the difference between a and b? Both seem to do the same
thing but obviously there is a difference as I cannot instanciate C with
buildin types as template parameter ("C!int c" results in "Error:
template instance C!(int) does not match template declaration C(alias T)").

The other question is: is there a possibility to distinguinish between
different "things" passed to a template alias paramter? - Like "isType",
"isVariable", "isLiteral", "isTemplate" ...

enuhtac


More information about the Digitalmars-d-learn mailing list