[webkit-dev] about WTF::HashMap::iterator
ZHOU Xiao-bo
zhxb.ustc at gmail.com
Wed Apr 8 21:02:26 PDT 2009
hi all:
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, but it's because the
member variable 'm_table' in WTF::HashTable::iterator may become NULL
if there is only one entry in the HashMap before you call remove( olditer ).
So, how can I delete an element of a HashMap when I traversing the
container? e.x.
while( iter ) {
oldIt = iter;
++iter;
remove( oldIT ); // not always safe
}
thx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090409/569f5741/attachment.html>
More information about the webkit-dev
mailing list