Dominic Jones:

I want to overload a primitive type operator so that I can do something like

double a;
myStruct b;
writeln(a + b);

You can't overload the operator of a primitive, but binary operators come in left and right versions:
http://dlang.org/operatoroverloading.html#Binary

a.opBinary!("op")(b)
b.opBinaryRight!("op")(a)

so adding an inverse "+" operator inside myStruct is possible.

Bye,
bearophile

Reply via email to