Compound assignment operators
Jonathan M Davis
jmdavisprog at gmail.com
Wed Aug 25 23:46:02 PDT 2010
On Wednesday 25 August 2010 22:31:38 Yao G. wrote:
> Sorry, I sent the message prematurely :( Anyway, here's complete:
>
> Is there a way to make compound assignment operators (-=, +=, *= and
> friends) work with D's operator overload regime? I can't make them work.
Look at http://www.digitalmars.com/d/2.0/operatoroverloading.html (or even
better, TDPL). The correct function would be opOpAssign. I believe that the
syntax for += would be
opOpAssign!("+")(args) { }
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list