opIndexAssign

Salih Dincer salihdb at hotmail.com
Thu Oct 5 20:23:45 UTC 2023


On Thursday, 5 October 2023 at 12:00:22 UTC, Timon Gehr wrote:
>
>
> void opIndexAssign(int value, int index){ i[index] = value; }

In this case I need to define many operator overloads. For 
example (+=), this won't work without returns ref:

```d
   s[1] += 3;
   assert(s.i == [2, 45]);
// Error: no `[]` operator overload for type `S`
```
SDB at 79



More information about the Digitalmars-d-learn mailing list