Forward declarations of template specilizations.

Jarrett Billingsley jarrett.billingsley at gmail.com
Sun Nov 16 13:00:19 PST 2008


On Sun, Nov 16, 2008 at 3:52 PM, Ryan Bloomfield
<_sir_maniacREMOVE_ME at yahoo.com> wrote:
> According to http://www.digitalmars.com/d/1.0/templates-revisited.html(under "Template Parameters") a template can be passed as a template argument.  How does one do that? The compiler (gdc) give an error when I try to pass a template like a type(complains it isn't a type).

You use an alias parameter instead of a type parameter.

template A(alias Foo)
{
    alias Foo!(int) A;
}

template B(T)
{
    T B;
}

alias A!(B) x; // same as declaring "int x"



More information about the Digitalmars-d mailing list