[PATCH] Convert SV_PTRARR with std::deque

Kohei Yoshida kohei.yoshida at gmail.com
Mon Mar 26 08:15:31 PDT 2012

On Mon, 2012-03-26 at 11:01 -0400, Kohei Yoshida wrote:

> First off, it's my understanding that the old container took ownership
> of the contained elements i.e. when the pointer that points to an
> instance is removed from the container it would call delete on that
> pointer to delete the object.  So, it's probably wise to double-check
> what the old SV_PTRARR container did before pushing this change.  If it
> did indeed managed the life cycle of the stored elements, then it's more
> appropriate to use boost::ptr_vector or similar (not sure if there was
> ptr_deque...).  If it didn't, then, ignore my suggestion. ;-)

In addition to that, it's also possible that the objects that these
pointers point to should not be managed by this container, in which
case, use of std::deque or std::vector without explicit deleting is just
fine.  Double-checking the code where it's used seems to suggest that
that may be the case, but again I'm not a Writer guy so don't take my
word for it. ;-)

One thing that you might try is (if the above is true) to store const
pointer instead of a plain pointer to see if that compiles, and if it
does, then you can remove those const_cast that you added when inserting
pointers to the new container.



More information about the LibreOffice mailing list