Re: [gtkmm] using RefPtr out of Gtkmm



On Tuesday 10 February 2004 23: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
                                            ^^^^^^^^^^^^^
Correction, that should be reference() and unreference().

Incidentally, I see that the book/tutorial indicates that if a reference 
counting shared pointer gets into the C++ standard, that will be used instead 
of Glib::RefPtr.  Boost also has an intrusive pointer (boost::intrusive_ptr) 
similar in effect to Glib:: RefPtr which I think has also been submitted as 
an addition to the standard, and if it is accepted it would be better to go 
for that, as it could then be plumbed into the GTK+ object system (in 
particular, g_object_ref() and g_object_unref()) in the same way that 
Glib::RefPtr is, rather than duplicating it.

Chris.




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