On Sunday, 17 December 2023 at 04:13:20 UTC, Ki Rill wrote:
I am trying to overload `opOpAssign` for my class. The code compiles, but it does not seem to be working.

```d
// binary operations have already been implemented for Value
// i need +=, -=, *=, /=
auto opOpAssign(string op)(Value rhs)
{
    mixin("return this" ~ op ~ "rhs;");
}

auto opOpAssign(string op)(in ElementType rhs)
{
    mixin("return this" ~ op ~ "rhs;");
}
```

What am I missing here? Full project code can be found [here](https://github.com/rillki/tiny-grad).

Perhaps:
```d
auto opOpAssign(string op)(Value other) {
mixin("this.v " ~ op ~ "= other.v;");
return this;
}
```

Reply via email to