On 2020-04-04 10:32:32 +0000, Ferhat Kurtulmuş said:

struct S {
     float a;
     float b;

     S opOpAssign(string op)(ref S rhs) if (op == "+"){
         this.a += rhs.a;
         this.b += rhs.b;
         return this;
     }
}

If the struct is from some 3rd party source, how can I add such an operator overloading to it? Is it possible to "extend" a struct later?

--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster

Reply via email to