Put Tuple in templates in a class fails

Xan xancorreu at gmail.com
Sun May 13 02:58:29 PDT 2012


Thank you very much, Philippe.

I have several questions:

* Why do you think I can't compose functions with tuples? Your 
implentation does exactly this, isn't?

* What is RHS?

Thanks,
Xan.

On Thursday, 10 May 2012 at 20:17:12 UTC, Philippe Sigaud wrote:
> On Thu, May 10, 2012 at 4:48 PM, Xan <xancorreu at gmail.com> 
> wrote:
>
>> public class Algorisme(V,U...) {
>>
>> but when I do: https://gist.github.com/2653643
>>
>> I get error:
>> prova_amb_tuples_a_Algorisme.d:84: Error: 'alg' is not of 
>> arithmetic type,
>> it is a 
>> prova_amb_tuples_a_Algorisme.Algorisme!(int,int).Algorisme
>> prova_amb_tuples_a_Algorisme.d:84: Error: 'alg2' is not of 
>> arithmetic type,
>> it is a 
>> prova_amb_tuples_a_Algorisme.Algorisme!(int,int).Algorisme
>
> You have to help the type-deduction algorithm a bit. By 
> exposing the
> Domini/Codomini tuples, for example.
> Here:
>
> https://gist.github.com/2655583
>
> See the new template constraint on lines 52-54 and the helper 
> template
> at the beginning of the file.
>
> Also, in the string example, you inverted the domain and 
> codomain.
>
> Btw, I'm not sure you can compose function with
> tuple-domains/codomains in general...
>
>
> Philippe




More information about the Digitalmars-d-learn mailing list