Re: creating a vector of a vector of Gtk::ToggleButton
- From: Chris Vine <chris cvine freeserve co uk>
- To: gtkmm-list gnome org
- Cc: Carl Nygard <cjnygard fast net>, Paul Davis <paul linuxaudiosystems com>
- Subject: Re: creating a vector of a vector of Gtk::ToggleButton
- Date: Sat, 30 Oct 2004 13:36:02 +0100
On Thursday 28 October 2004 05:04, Carl Nygard wrote:
> On Wed, 2004-10-27 at 23:48, Paul Davis wrote:
> > your mileage may vary as to whether you consider a ToggleButton to
> > have "weight". note that this approach also means that vector::clear()
> > (and container::clear() in general) does *not* free the objects
> > pointed to, which can be problematic sometimes.
>
> I second that. I usually use a smartptr to deal with the delete problem
> in STL containers.
>
> <blatant plug>
> If you don't want to use the boost lib, there's a decent smart pointer
> implementation that I'm maintaining (originally from Kevin S. Van Horn)
> at http://www.3sinc.com/opensource/ that should do the trick.
> </blatant plug>
This is quite clever. A "swiss pen knife" of smart pointers, with four for
the price of one - shared pointer, invasive pointer, clone-referenced-object
pointer and a copy-referenced-object-on-write pointer. I am not sure I would
ever want to use of the last of those.
It might be useful to add a pure scoped pointer, one which does not clone a
referenced object (even if the referenced object is cloneable) and which once
initialised does not allow the identity of its referenced object to be
changed. (Although I realise that a const std::autoptr will do most of this
for you.)
However I notice that you release it under the GPL whereas Kevin Horn released
it as public domain. To make the library more useful it would be a good idea
to indicate what the new code is (if any) which is GPL-only.
Chris.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]