Boost logo

Boost Users :

From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2007-02-06 10:02:55


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 05 February 2007 18:28 pm, Timmo Stange wrote:
> But is that really a problem? If you set up the connection from the
> constructor, you can also disconnect it in the destructor and don't
> need automated tracking.

Yes, I guess it's no big deal. In fact, the reason the possible solutions
were unacceptable to me was that manual connection management was so
comparatively easy in this case.

> On a side note: I don't think my current "tracked" wrapper will allow
> binding to a pointer to member function. It doesn't have overloads
> for dereferencing and the implicit conversion to shared_ptr won't
> help here.

It turns out it doesn't need to be implicitly convertible to shared_ptr at
all, like I imagined before I read the mem_fn docs. It just needs a
get_pointer function. I'm currently using a stripped down
signals::tracked object that is just a thin wrapper around weak_ptr, with
the following get_pointer function:

template<typename T>
T* get_pointer(const signals::tracked<T> &tracked) {return
tracked.lock().get();}
 
I'll commit it in a bit, I've still got some bugs to work out (but it does
bind and invoke successfully).

- --
Frank
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFyJik5vihyNWuA4URAlaaAKC6LMj8g6sS2rCVGUR89SsOevsd3gCg09Vq
P2EX9mXVUzVcXTpTorA46lk=
=QjBq
-----END PGP SIGNATURE-----


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net