Can i rewrite methods in one line?

Ivan Agafonov armadil at yandex.ru
Sun Sep 2 21:40:16 PDT 2012


Note that opBinary operators uses op= instead of op :

Vector opBinary(string op) (Vector rhs) if(isMathOp(op))
{ return Vector(mixin("array.dup[] "~op~"= rhs.array[]")); }

Vector opBinary(string op) (T rhs) if(isMathOp(op))
{ return Vector(mixin("array.dup[] "~op~"= rhs")); }


More information about the Digitalmars-d-learn mailing list