How do I overload += operator?

Q. Schroll qs.il.paperinik at gmail.com
Mon Jan 25 22:56:19 UTC 2021


On Monday, 25 January 2021 at 21:53:15 UTC, Jack wrote:
> That naming is confusing

op: it is an operator method
Op: it takes an operator as a parameter
Assign: kinda obvious.

As an example, there are opIndex, opIndexAssign and 
opIndexOpAssign.
opIndex overloads obj[i].
opIndexAssign overloads obj[i] = rhs, and
opIndexOpAssign overloads opj[i] += rhs.

Maybe, in the greater scheme, the naming makes more sense to you.


More information about the Digitalmars-d-learn mailing list