Revised RFC on range design for D2
Walter Bright
newshound1 at digitalmars.com
Fri Sep 12 12:45:58 PDT 2008
Andrei Alexandrescu wrote:
> Ary Borenszweig wrote:
>> - Is it possible to add elements to a range? Suppose a linked list,
>> you want to traverse it's elements until a condition is met on an
>> element, and then add something after it. Or before it. I see there's
>> "put", but it also says "An output range models a one-pass forward
>> writing iteration.", so I think it's not the same.
>
> Never. Ranges never grow. You need access to the "mother" container,
> which will offer primitives for insertion and removal of elements.
I agree. I don't think it is ever a good idea to try to add/remove
elements of a container while iterating over it. foreach disallows it.
More information about the Digitalmars-d-announce
mailing list