On Wednesday, 14 July 2021 at 14:39:03 UTC, vit wrote:
On Wednesday, 14 July 2021 at 13:16:49 UTC, Tejas wrote:
On Wednesday, 14 July 2021 at 13:09:56 UTC, vit wrote:
On Wednesday, 14 July 2021 at 12:49:58 UTC, Tejas wrote:
[...]
From doc: https://dlang.org/spec/operatoroverloading.html
Postincrement e++ and Postdecrement e-- Operators
These are not directly overloadable, but instead are
rewritten in terms of the ++e and --e prefix operators:
Postfix Operator Rewrites
op rewrite
e-- (auto t = e, --e, t)
e++ (auto t = e, ++e, t)
Rewriting part doesn't work with operator overloading.
If the rewriting part doesn't work with over
This work:
```d
import std.stdio;
struct abc{
int[100] a;
ref int opIndex(int index)return{
return a[index];
}
}
void main (){
abc s;
s[0]++;
++s[0];
}
```
Oh... since it was asking for an lvalue, you just passed it by
reference... seems so obvious in hindsight...
Nice.
Pity it doesn't seem to solve OP's problem.