Re: What's opIndexAssign supposed to return ?

2020-02-25 Thread wjoe via Digitalmars-d-learn
On Tuesday, 25 February 2020 at 15:30:19 UTC, Ali Çehreli wrote: On 2/25/20 3:02 AM, wjoe wrote:> Lets say I've got 3 overloads of opIndexAssign: > > auto opIndexAssign(T t); > an internet search which didn't find any useful > information. I have examples for non-templatized and templatized ve

Re: What's opIndexAssign supposed to return ?

2020-02-25 Thread Ali Çehreli via Digitalmars-d-learn
On 2/25/20 3:02 AM, wjoe wrote:> Lets say I've got 3 overloads of opIndexAssign: > > auto opIndexAssign(T t); > an internet search which didn't find any useful > information. I have examples for non-templatized and templatized versions of opIndexAssign here: http://ddili.org/ders/d.en/opera

Re: What's opIndexAssign supposed to return ?

2020-02-25 Thread wjoe via Digitalmars-d-learn
On Tuesday, 25 February 2020 at 11:49:50 UTC, Petar Kirov [ZombineDev] wrote: On Tuesday, 25 February 2020 at 11:02:40 UTC, wjoe wrote: [...] opIndexAssign is the operator used in the following code: arr[1] = 8; It returns the element at index 1 (so 8 in this case) by reference. This allow

Re: What's opIndexAssign supposed to return ?

2020-02-25 Thread Petar via Digitalmars-d-learn
On Tuesday, 25 February 2020 at 11:02:40 UTC, wjoe wrote: Lets say I've got 3 overloads of opIndexAssign: auto opIndexAssign(T t); auto opIndexAssign(T t, size_t i); and auto opIndexAssign(T t, size_t[2] i); I would assume to return what I would return with opIndex but I'd rather not act upon

What's opIndexAssign supposed to return ?

2020-02-25 Thread wjoe via Digitalmars-d-learn
Lets say I've got 3 overloads of opIndexAssign: auto opIndexAssign(T t); auto opIndexAssign(T t, size_t i); and auto opIndexAssign(T t, size_t[2] i); I would assume to return what I would return with opIndex but I'd rather not act upon assumptions. But if yes is it supposed to be the newly assi