gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-commit] /srv/bzr/gnash/trunk r9668: Plug leak.


From: Benjamin Wolsey
Subject: Re: [Gnash-commit] /srv/bzr/gnash/trunk r9668: Plug leak.
Date: Fri, 05 Sep 2008 08:42:42 +0200

> template<typename Container>
> void
> delete_ptr_container(Container& c)
> {
>    using namespace boost;
> 
>    typedef typename range_value<Container>::type ContainedPtrType;
>    typedef typename remove_pointer<ContainedPtrType>::type ContainedValType;
> 
>    std::for_each (begin(c), end(c), checked_deleter<ContainedValType>());
> }

Now I really like it :) (apart from the underscored name, that is).

I also think leaving clear() to the caller would be an improvement
rather than a problem, as most of the time the container is destroyed
immediately afterwards, and when it's not, the caller can decide if or
how much clearing is necessary.

Where would you put it? I'm not that keen on utility.h, but it seems
like the most appropriate place for it. It would be used at least in
PlaceObject2Tag.cpp and sound_handler_sdl.cpp, so libcore and libmedia.
Alternatively, we could start a new header file in libbase for really
useful common code and leave the compatibility hacks to utility.h.

It does work with boost 1.33, doesn't it? I know boost.Range is in that
version, but I haven't tested this code specifically.

bwy.

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]