Operator "+=" overloading for class?

Ki Rill rill.ki at yahoo.com
Sun Dec 17 04:25:26 UTC 2023


On Sunday, 17 December 2023 at 04:15:02 UTC, Ki Rill wrote:
> On Sunday, 17 December 2023 at 04:13:20 UTC, Ki Rill wrote:
>> I am trying to overload `opOpAssign` for my class. The code 
>> [...]
>> 
>
> I forgot to mention, it is relevant to 
> [`Value`](https://github.com/rillki/tiny-grad/blob/main/source/rk/tgrad/core/value.d) class only.

This unittest fails:
```d
// test opOpAssign
auto g = value(0);
g += value(3);
assert(g.data == 3);
```


More information about the Digitalmars-d-learn mailing list