Operator overloading

silverling este_aqui_ at hot_mail.com.remove.underscores
Thu May 10 12:09:10 PDT 2007


I have overloaded the multiplication operator like this

opMul(T)(T number){...}
opMulAssign(T)(Tn number){...}

Now, I want another multiplier to multiply with a specific class (itself) so generally, one would write (after the other overloads)

opMult(T:classA)(T multiplier)

as it is specified on the language specs http://www.digitalmars.com/d/template.html under the "Specialization" section. However, DMD refuses to compile, saying that "specialization not allowed for deduced parameter T". I'd really hate to have to overload the opMul with real/long/cfloat/classA/etc. How can I fix this?


More information about the Digitalmars-d-learn mailing list