Re: Is it possible to store pointers in Gtk::Liststore?
- From: Michael Hasselmann <michael taschenorakel de>
- To: Daniel Elstner <daniel kitta googlemail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Is it possible to store pointers in Gtk::Liststore?
- Date: Tue, 23 Jun 2009 20:56:47 +0200
Am Dienstag, den 23.06.2009, 16:30 +0200 schrieb Daniel Elstner:
> Am Montag, den 22.06.2009, 23:32 +0200 schrieb Germán Diago:
> >
> > I've used a void* above because I was having trouble with
> > pointers to
> > complex objects, but I think that was due to having a static
> > DLF_ModelColumns instance instead of instantiating it when
> > needed. It
> > should be OK to include a pointer to anything you want.
>
> It can be static, as long as a it isn't instantiated before Gtk::Main.
> What I usually do is to have a function which simply returns a reference
> to a static variable defined inside the function body.
Also see Commandme^WItem 4 of the superb (and very well-written)
"Effective C++ Third Edition" of Scott Meyers.
> On a side note, you might want to use a smart pointer instead, or the
> memory management will get hairy. But I don't know your circumstances,
> so maybe this doesn't apply.
Item 13, same book. Really, this book is a must-read (says a C++ newbie,
heh!)
regards,
Michael
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]