Re: weak pointer
- From: Murray Cumming <murrayc murrayc com>
- To: Bram Neijt <bneijt gmail com>
- Cc: GTKmm mailinglist <gtkmm-list gnome org>
- Subject: Re: weak pointer
- Date: Tue, 24 Jul 2007 20:33:01 +0200
On Sat, 2007-07-21 at 19:28 +0200, Bram Neijt wrote:
> Hi developers,
>
> I need a weak pointer in glibmm. I was thinking about something like:
> template <typename Tobj>
> class WeakPtr: private RefPtr<Tobj>
> {
> RefPtr<Tobj> a;
> public:
> WeakPtr(other RefPTr)
> {
> a = reptr;
> a.cppObject->unreference();
> }
>
> RefPtr<Tobj> lock()
> {
> //Try to get a valid RefPtr from a
> //if it's not valid, throw an error.
> }
> };
>
> Would it be possible to start a discussion about the full
> implementation and get this into glibmm if I put in some effort to
> implement it more correctly?
I guess so, though I wonder if boost already has something, or can at
least provide inspiration.
This might also be useful:
http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#g-object-weak-ref
--
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]