to invalidate a range
Ellery Newcomer
ellery-newcomer at utulsa.edu
Fri Aug 12 13:58:15 PDT 2011
On 08/12/2011 03:29 PM, Steven Schveighoffer wrote:
> On Fri, 12 Aug 2011 15:54:53 -0400, Ellery Newcomer
> <ellery-newcomer at utulsa.edu> wrote:
>
>> in std.container, the stable* container functions advocate that they
>> do not invalidate the ranges of their containers. What does it mean to
>> invalidate a range?
>
> Say for example, you are iterating a red black tree, and your current
> "front" points at a certain node. Then that node is removed from the
> tree. That range is now invalid, because the node it points to is not
> valid.
Then there is no way to implement a stable remove from a node based
container?
> Another example of an invalidated range, let's say you have a hash map.
> The range has a start and a finish, with the finish being iterated after
> the start. If you add a node, it could cause a rehash, which could
> potentially put the finish *before* the start!
Then the invalidation is that the range failed to produce an element of
the container?
More information about the Digitalmars-d-learn
mailing list