Re: [gtkmm] using RefPtr out of Gtkmm
- From: Murray Cumming <murrayc murrayc com>
- To: Chris Vine <chris cvine freeserve co uk>
- Cc: gtkmm-list <gtkmm-list gnome org>, Jose Felix Hernandez Barrio <jfhernandez etsii upm es>
- Subject: Re: [gtkmm] using RefPtr out of Gtkmm
- Date: Wed, 11 Feb 2004 20:12:04 +0100
On Wed, 2004-02-11 at 00:23, Chris Vine wrote:
> On Tuesday 10 February 2004 14:30, Murray Cumming wrote:
> > On Fri, 2004-02-06 at 18:34, Jose Felix Hernandez Barrio wrote:
> > > Hi,
> > >
> > > I'm developing an application that must use a smart pointer, and i have
> > > a few questions:
> > >
> > > 1- Is there any tutorial for refptr?
> > > 2- Can i use refptr out of gtkmm class hierarchy? must i derive my
> > > classes from any glib o gtk classes and add any functionality ???
> >
> > RetPtr is documented in the reference documentation and the book. It is
> > not a general purpose smartpointer. But it's not difficult to write a
> > general purpose shared reference-counting smartpointer.
>
> However, Glib::RefPtr appears to be a fairly typical intrusive smart pointer.
> According to the gtkmm/glibmm documentation it only requires the referenced
> object to have reference() and dereference() methods (in other words, to
> increment and decrement its own reference count and to delete itself when
> this drops to 0). If these are home-made objects, this is very easy to do,
> and if you are already using glibmm is probably worth doing as it saves
> having to add another library or dependency.
I generally find that it is better and easier to implement a generic
_non-intrusive_ reference-counting shared smartpointer. You can see
examples of me doing that in mysqlcppapi and dbus-cpp, and probably
other places.
--
Murray Cumming
www.murrayc.com
murrayc murrayc com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]