opIndexAddAssign? ...
Lionello Lunesu
lio at lunesu.remove.com
Fri Feb 9 03:53:11 PST 2007
Manfred Nowak wrote:
> On writing the implementation of a map, where the Valuetype is a set, I
> had to stop on recognizing, that only opIndexAssign is permitted.
>
> I.e.:
> map[ key]+= element;
> has no possible overload.
>
> OpIndex delivers an rvalue and the only possibility to get an lvalue is
> in conjunction with a plain assignment.
>
> Why arbitrary restrictions when the goal is to have great
> expressiveness?
>
> -manfred
opIndexAssign was needed because D has no "inout" return type. It's a
hack, if you ask me.
L.
More information about the Digitalmars-d
mailing list