Operator Overloading in an Abstract Base Class

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 20 14:39:11 PST 2014


On 11/20/2014 02:18 PM, "Nordlöw" wrote:
> On Thursday, 20 November 2014 at 22:10:28 UTC, Nordlöw wrote:
>> In my module symbolic.d at
>>
>> https://github.com/nordlow/justd/blob/master/symbolic.d
>>
>> is it somehow possible to overload binary operator ~ on pairs of
>> instances SPatt?
>
> As usual I had done a couple of mistakes...which are solved know at
>
> https://github.com/nordlow/justd/blob/master/symbolic.d#L63
>
> Why can't I find these bugs before I do my posts? :)

Glad that it works. :)

Not directly related to your post but just because your post reminded 
me, there is the following feature that simplifies matters when one 
needs virtual operators:

   template opOpAssign(string op) if (op == "~")
   { alias concatAssign opOpAssign; }

Here is the enhancement request:

   https://issues.dlang.org/show_bug.cgi?id=5893

And here is the implementation including the tests:

 
https://github.com/D-Programming-Language/dmd/pull/989/files#diff-51d0a1ca6214e6a916212fcbf93d7e40R246

Ali



More information about the Digitalmars-d-learn mailing list