Iterators for D
Jarrett Billingsley
kb3ctd2 at yahoo.com
Mon Nov 6 18:54:43 PST 2006
"Walter Bright" <newshound at digitalmars.com> wrote in message
news:eio6u5$1j6o$1 at digitaldaemon.com...
> Overload opIndex for rvalue access
> Overload opIndexAssign for lvalue access
Somehow..
foreach(i; foo)
{
auto x = i[0];
i[0] = x + 1;
}
You often say that operator overloading should be used only what it should
be used for, and taking the index of an iterator means.. what exactly?
Would it be nicer to just use a .value property instead?
foreach(i; foo)
{
auto x = i.value;
i.value = x + 1;
}
More information about the Digitalmars-d
mailing list