[Libreoffice] Problems with windows build

Steven Butler sebutler at gmail.com
Mon Feb 14 03:16:45 PST 2011


Hi,

On 14 February 2011 21:05, Michael Meeks <michael.meeks at novell.com> wrote:

>        I wonder if the stlport iterators were simply more robust against
> changes in the underlying structures. Is this a list it is iterating or
> a hash ? If the latter then changes in the 'hash' had undefined (but
> non-crashy) behaviour with stlport.

I remember writing some code a number of years ago that iterated over
a map and deleted 'expired' items during iteration.

Using libstdc++ on CentOS 4 vintage I definitely had to take a local
copy of the iterator, move on to the next item using ++ii, then delete
the item using the copy of the iterator (and never use the copy
again), otherwise it would crash.

The code didn't look as pretty as using a simple for
(std::map<string,bar>::iterator ii(foo.begin(); ii!= foo.end(); ++ii)
loop, but at least it worked.

I think there is no guarantee in STL for certain data types (like
maps) when you erase the value at the iterator.  I never used the hash
- it always seemed to use more memory than maps, and wasn't any faster
with what I was trying to do.

STLport might be a bit more clever about this kind of (ab)use, or it
might just be luck.

Regards
Steven


More information about the LibreOffice mailing list