Question about explicit template instantiation

Janice Caron caron800 at googlemail.com
Sun Feb 10 15:25:24 PST 2008


On 10/02/2008, Janice Caron <caron800 at googlemail.com> wrote:
> On 10/02/2008, Jesse Phillips <jessekphillips at gmail.com> wrote:
> > Well, you can't write A!(int) x; unless you precede it with alias.
>
> Not so.
>
>     template A(T)
>     {
>         int A;
>     }
>
>     A!(double) = 42;
>     writefln(A!(double)); // prints 42
>     writefln(typeof(A!(double))); // prints double

Whoa! Big mistake! Sorry. Typo. Got that wrong. Don't want to confuse
anyone! Let's try again...

     writefln(typeof(A!(double))); // prints int

That's better!
Phew!



More information about the Digitalmars-d mailing list