Templates in classes => what is wrong?

Xan xancorreu at gmail.com
Sun Apr 15 11:39:09 PDT 2012


On Sunday, 15 April 2012 at 11:23:37 UTC, John Chapman wrote:
> On Sunday, 15 April 2012 at 11:16:43 UTC, Xan wrote:
>>
>> int main(string [] args)
>> {
>>    auto alg = Algorisme!(int,int);
>
> Should be:
>       auto alg = new Algorisme!(int, int);
>
>>    alg.nom = "Doblar";
>>    alg.versio = 1;
>>    alg.funcio = (int a) {return 2*a};
>
> Should be:
>       alg.funcio = (int a) { return 2 * a; };
> or:
>       alg.funcio = a => 2 * a;
>
>> }


It does not work:

  $ gdmd-4.6 algorisme.d
algorisme.d:18: Error: variable algorisme.main.alg voids have no 
value
algorisme.d:18: Error: expression class Algorisme is void and has 
no value

with the code https://gist.github.com/2394274

What fails now?

Thanks,
Xan.


More information about the Digitalmars-d-learn mailing list