Template constraints and opAdd

John dont at email.me
Mon Jul 1 18:12:29 PDT 2013


On Tuesday, 2 July 2013 at 00:01:48 UTC, bearophile wrote:
> John:
>
>> 	Mass!(T,S) opAdd(Mass!(T,S) other) {
>
> If you are using D2 then don't use opAdd, use opBinary:
>
> http://dlang.org/operatoroverloading.html#Binary
>
> Bye,
> bearophile

Thanks, I switched over to using the new function and after 
fiddling with the functions I came up with a pair that seem to 
work.

Mass!(T,S) opBinary(alias operator)(Mass!(T,S) other) {
Mass!(T,S) opBinary(alias operator, O)(Mass!(O,S) other) if 
(!is(O == T)) {


More information about the Digitalmars-d-learn mailing list