opIndexAddAssign? ...
Jarrett Billingsley
kb3ctd2 at yahoo.com
Fri Feb 9 05:56:34 PST 2007
"Lionello Lunesu" <lio at lunesu.remove.com> wrote in message
news:eqhnb7$2tjh$2 at digitaldaemon.com...
> opIndexAssign was needed because D has no "inout" return type. It's a
> hack, if you ask me.
Ehhh, I don't really think so.. having opIndexAssign is nice because you can
do some processing on the value when it's assigned. How, for example would
you do something as simple as this:
void opIndexAssign(int value, int key)
{
mData[key] = value % 10;
}
using inout return values? In almost every one of my opIndexAssign
overloads, I do some kind of checking or processing on the value before
inserting it into the internal container.
More information about the Digitalmars-d
mailing list