[Issue 18998] Improve Operator Overloading docs
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Dec 11 16:30:37 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=18998
--- Comment #5 from Nick Treleaven <nick at geany.org> ---
> try and understand how to implement a slicing operator properly. Note that the first contact you see looks like this:
> `-a[i..j] a.opIndexUnary!("-")(a.opSlice(i, j))` wat?!
I think the docs for opIndexUnary, opIndexAssign and opIndexOpAssign should be
moved to the Indexing and Slicing Operators section where they make more sense.
> Make a point that multi-dimensional indexing is even supported, and that it is a separate topic,
With the 2nd pull I have tweaked the slicing docs to introduce 1D slicing first
with an example, then move on to multidimensional.
> and requires different handling than 1d.
Well non-template opSlice(i, j) 'is discouraged', so they're not different
really.
--
More information about the Digitalmars-d-bugs
mailing list