Container insertion and removal

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Mar 6 14:18:27 PST 2010


Michel Fortin wrote:
> On 2010-03-06 14:55:49 -0500, Andrei Alexandrescu 
> <SeeWebsiteForEmail at erdani.org> said:
> 
>> Steven Schveighoffer wrote:
>>> How can softRemove not affect iterating ranges?  What if the range is 
>>> positioned on the element removed?
>>
>> With GC, you can softRemove things without invalidating iterators.
> 
> What exactly is an "invalidated" iterator? Is an iterator that no longer 
> points to the container still "valid"? Or is "valid" just another word 
> for "memory safe"?
> 
> Wouldn't the notion of "detached" iterators/ranges be more useful?

Good question. In STL, invalidation roughly means undefined behavior if 
you use it. With GC in tow, the concept could be significantly milder. 
For example, reallocating an array would leave the old contents of the 
array sort of around, just obsoleted and also depleted of meaningful 
content if the data type has a destructor.

Andrei



More information about the Digitalmars-d mailing list