Container insertion and removal

Joel C. Salomon joelcsalomon at gmail.com
Mon Mar 8 09:44:29 PST 2010


On 3/6/2010 5:18 PM, Andrei Alexandrescu wrote:
> 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.

So it’s still a bug to use an invalidated iterator/range, and probably
still has unusual (if no longer undefined) effects if you do follow it,
but it (probably) won’t cause memory corruption.  Is that correct?

—Joel Salomon



More information about the Digitalmars-d mailing list