Why do associative arrays return from opIndexAssign by value?
TommiT
tommitissari at hotmail.com
Tue Jun 18 02:41:03 PDT 2013
On Tuesday, 18 June 2013 at 09:28:04 UTC, Jonathan M Davis wrote:
>
> Assignment operators definitely should return lvalues normally.
> I don't know
> why deadalnix would think otherwise. It's pretty much the norm
> in C++, and I
> see no reason for it to be different in D. No, it doesn't work
> for all types,
> but in the general case, it should.
At least int assignment isn't lvalue. I find this quite
surprising:
void edit(ref int) { }
void main()
{
int n;
//edit(n = 4); // Error
edit(n += 4);
}
More information about the Digitalmars-d
mailing list