How to overload + = in Julia?
I am trying to understand how operator overloading works in Julia. The manual is quite short and gives +()
as an example function then states that all operators are overloaded with their obvious names (a list of non-obvious names is also provided).
But what about +=?
Function +=()
doesn't even exist, and doesn't work +=!()
(since it's a modifying function). I often overload operators in C ++ by first defining +=
and then using a simple +
copy-based and +=
.
In my case, I don't even think what I need +
, just the behavior +=
... I understand that I can write my own modifying function, but the operator syntax will be nice. (Out of curiosity, how they work *=
, /=
, $=
etc?)
source to share