Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


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.

Regards,

Kohei


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.