What's opIndexAssign supposed to return ?

wjoe invalid at example.com
Tue Feb 25 11:02:40 UTC 2020


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 assigned values or the 
pre-assignment ones ? By value or by reference ? And if it's the 
new stuff can I just return t ?

The language manual on operator overloading didn't answer that 
question and neither did an internet search which didn't find any 
useful information. Something unrelated and a heads up about 
introducing opIndexAssign from 2004.




More information about the Digitalmars-d-learn mailing list