Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-02-23 13:46:07


Gottlob Frege wrote:

> That is what I was expecting it to look like, but don't you think a
> solution that goes beyond signals/slots would be beneficial (if it is
> possible to do)?
> I've used bind/function in threads before (managing or knowing the
> lifetime independently) OUTSIDE of signals/slots, so I'd love to see
> the more general solution.
>
> I know I've seen people asking for boost bind/function to work with
> weak_ptrs.

It would make quite a bit of sense sense for bind/mem_fn to accept a
weak_ptr as the object argument and throw a bad_weak_ptr if it expires. This
was my favorite approach of replacing the current tracking mechanism since
I'm a devoted fan of the KISS principle.

Relying on this alone was considered not enough, though. The reasons that've
been cited were (1) that one could reasonably want to use a weak_ptr or a
tracked pointer as another argument, and (2) that delaying the automatic
disconnect until the slot is actually called may consume unacceptably large
amounts of memory in scenarios where objects are frequently connected and
then exprire, while signal calls are rare.


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