On Friday, 20 April 2012 at 14:18:37 UTC, Dmitry Olshansky wrote:
On 20.04.2012 18:10, Xan wrote:
What fails if I want to define this:

Algorisme!(T,V) opBinary(string op)(Algorisme!(T,U) alg) {

 Algorisme!(T,V) opBinary(string op, T)(Algorisme!(T,U) alg) {

You need to name what T is and that is *sometype*. Anyway I suggest getting a decent book (TDPL).

if (op=="*") {

static if is conceptually and technically better here.


Thanks, Dmitry, for your suggestions, but it does not work too:

$ gdmd-4.6 algorisme
algorisme.d:54: Error: 'alg' is not of arithmetic type, it is a algorisme.Algorisme!(int,int).Algorisme algorisme.d:54: Error: 'alg2' is not of arithmetic type, it is a algorisme.Algorisme!(int,int).Algorisme


I update de gist: https://gist.github.com/2429005

By the other hand, is there any way to put the definition of operator * in the class (not out like I have now)?


Thanks,
Xan.

Reply via email to