Comment #0 by dieselmachine — 2015-03-17T19:28:11Z
Created attachment 1493
Test case
According to the documentation at http://dlang.org/operatoroverloading.html slice operators should be rewritten like
a.opIndexUnary!("$(METACODE op)")(a.opSlice(i, j))
a.opIndexAssign(c, a.opSlice(i, j))
a.opIndexOpAssign!("$(METACODE op)")(c, a.opSlice(i, j))
but currently this code is not compiled. The test case is in the attachment.
Comment #1 by k.hara.pg — 2015-06-02T01:58:07Z
If you want to use new integrated array operator overloading mechanism, you should make the opSlice member function for i..j a template, like as:
//Slice opSlice(size_t i, size_t j) // NG
Slice opSlice(size_t dim)(size_t i, size_t j) // OK
{
Slice slice = Slice(i, j);
return slice;
}
After the rewriting, all tests will pass.
Comment #2 by razvan.nitu1305 — 2022-02-14T13:04:37Z