Put Tuple in templates in a class fails

Philippe Sigaud philippe.sigaud at gmail.com
Thu May 10 13:17:04 PDT 2012


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