[Libreoffice] Using STL for xml2cmp (2)

Kohei Yoshida kyoshida at novell.com
Thu Sep 30 04:40:32 PDT 2010

On Thu, 2010-09-30 at 09:05 +0200, David Tardon wrote:
> On Thu, Sep 30, 2010 at 02:19:03PM +0900, Seo Sanghyeon wrote:
> > Attached patch removes DynamicList and migrate its users from
> > DynamicList<T> to std::vector<T *>.
> > 
> > <vector> header is included. "list.hxx" is not removed because it is
> > still used for List class.
> > 
> Hi,
> std::vector<T*> is not a correct replacement for DynamicList<T>, because
> the latter manages the lifetime of its members, which std::vector does
> not do, therefore every remove causes a memory leak. 

You should consider using boost::ptr_vector<T> for that.  That one
stores pointers and it manages the lifecycle of stored instances.

OOo's internal boost already delivers headers for the ptr_container
family of boost.  So no need to modify the boost module in order to use


Kohei Yoshida, LibreOffice hacker, Calc
<kyoshida at novell.com>

More information about the LibreOffice mailing list