[webkit-dev] about WTF::HashMap::iterator
Darin Adler
darin at apple.com
Thu Apr 9 08:28:07 PDT 2009
On Apr 8, 2009, at 9:02 PM, ZHOU Xiao-bo wrote:
> WTF::Hashmap::iterator uses WTF::HashTable::iterator as its
> m_impl.
> When you call 'remove( oldIter )', the current 'iter' may be
> changed. And
> it's not about memory reallocation or element shift,
That’s incorrect. It is about memory reallocation and element shift.
In the remove function HashTable is the following code:
if (shouldShrink())
shrink();
The shrink function can change the size of the hash table and thus
rehash everything and change the order of all the elements in it.
> So, how can I delete an element of a HashMap when I traversing the
> container?
You can’t.
-- Darin
More information about the webkit-dev
mailing list