On Monday, 18 October 2021 at 03:42:35 UTC, Paul Backus wrote:
What happens here is, the compiler first tries the D2-style
rewrite:
```d
s.opIndexAssign(arr[1..4], s.opSlice!0(0, 3))
```
However, that rewrite fails to compile, because your `opSlice`
does not take a template argument
On Monday, 18 October 2021 at 04:11:18 UTC, Paul Backus wrote:
On Monday, 18 October 2021 at 03:42:35 UTC, Paul Backus wrote:
My guess is that you got into this situation by trying to
follow the example in the spec's section on ["Slice Assignment
Operator Overloading"][2]. Unfortunately, that
On Monday, 18 October 2021 at 03:42:35 UTC, Paul Backus wrote:
My guess is that you got into this situation by trying to
follow the example in the spec's section on ["Slice Assignment
Operator Overloading"][2]. Unfortunately, that example is
incorrect.
[2]:
On Sunday, 17 October 2021 at 22:52:27 UTC, Elmar wrote:
Hello Dear community.
I'd like to overload `opIndexAssign` for a struct which wraps
around a generic array (so that it can't support `opIndex` due
to unknown return type).
Broken down as much as possible this is the code:
```
import
Btw, I should have written:
`s.opIndexAssign(arr[1..4], s.opSlice(0,3));`
But it compiles the same way.
Hello Dear community.
I'd like to overload `opIndexAssign` for a struct which wraps
around a generic array (so that it can't support `opIndex` due to
unknown return type).
Broken down as much as possible this is the code:
```
import std.stdio : writeln;
import std.range : ElementType;