
On 2/23/07, Peter Dimov
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