Being consistent with mappings is the only good reason to do otherwise, afaics. Otoh I don't think it's impossible to make mapping iterators work with changing indices too, but I haven't looked into that in detail.
Is that behaviour useful in a practical situation?
If nothing else, it avoids a copy-on-write if you go through a set to remove items. That's something of a bummer with the current mapping iterators, I think.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-01-30 20:33: Subject: Multiset iterator
But then you get a different behaviour then for a mapping? (Array and string indexes can't change, so they don't matter here.)
Is that behaviour useful in a practical situation? To me, the risk of bugs is obvious, but then again most bugs I can think of would lead to infinite loops and thus detected easily.
( Like, multiset m; ... foreach (m;;int x) m[x+10000]=1; )
/ Mirar