Re: creating a vector of a vector of Gtk::ToggleButton
- From: Carl Nygard <cjnygard fast net>
- To: Rob Benton <rob benton conwaycorp net>
- Cc: gtkmm-list gnome org, Paul Davis <paul linuxaudiosystems com>
- Subject: Re: creating a vector of a vector of Gtk::ToggleButton
- Date: Thu, 28 Oct 2004 14:42:32 -0400
On Thu, 2004-10-28 at 11:13, Rob Benton wrote:
> Paul Davis wrote:
>
> <snip>
>
> >
> > typedef std::vector<Gtk::ToggleButton*> chiprow;
> > std::vector<chiprow*> _chips;
> >
> >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.
> >
> >--p
> >
> >
> >
> >
>
> I'm glad you mentioned that. I was wondering about the cost of pointer
> vs local object. Just looking at your example though would I really
> need to define _chips as a vector to pointers or would this work as well:
>
> typedef std::vector<Gtk::ToggleButton *> chiprow;
> std::vector<chiprow> _chips;
Do that. You don't want to deal with vector<chiprow*>, for the same
reason you don't really want the headache of
vector<Gtk::ToggleButton*>. You could wrap chiprow* in a smart pointer,
but it's totally unnecessary.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]