Boost logo

Boost Users :

From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2007-02-23 12:54:46


On 2/23/07, Peter Dimov <pdimov_at_[hidden]> wrote:
>
> I actually like the suggestion of just offering a way to add the tracked
> pointers manually. Either
>
> sig.connect( boost::bind( myfunction, boost::ref(coord->x) ), coord );
>
> or
>
> sig.connect( boost::bind( myfunction, boost::ref(coord->x) ).track( coord );
>
> Both look better on a syntactic level to me. In addition, I suspect that
> signalslib::track contains a race condition that is avoided by the other
> alternatives (but I haven't actually looked at it so I might be wrong; it's
> possible, if somewhat tedious, to implement it correctly).
>

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.

Tony


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