The definition of templates in D

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Mar 18 01:16:02 PDT 2012


On 3/18/12, Derek <ddparnell at bigpond.com> wrote:
> What would be useful is ...
>   bar!(a, b, c); // is equivalent to
>   bar!(int, int, int).bar(a, b, c);

You mean like this?

template bar(T...)
{
    void bar() { writeln(T); }
}

void main()
{
    int a = 1, b = 2, c = 3;
    bar!(a, b, c);
}


More information about the Digitalmars-d mailing list