Parameter-less templates?

Meta jared771 at gmail.com
Mon Aug 12 13:50:41 PDT 2013


On Monday, 12 August 2013 at 19:58:32 UTC, Jacob Carlborg wrote:
> Do you mean like:
>
> template Foo ()
> {
>     int a;
> }
>
> Unfortunately this doesn't work:
>
> Foo.a = 3;
>
> But this does:
>
> Foo!().a = 3;

class Foo
{
     static int a;
}

template Foo()
{
     int a = 0;
}

void main()
{
     Foo.a = 0;
}

Wouldn't this be a problem if that syntax was allowed?


More information about the Digitalmars-d mailing list