opIndexAddAssign? ...

Manfred Nowak svv1999 at hotmail.com
Fri Feb 9 00:56:50 PST 2007


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



More information about the Digitalmars-d mailing list