-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 02 February 2007 06:34 am, Timmo Stange wrote:
deliverNews.connect(boost::bind(&NewsMessageArea::displayNews, boost::signals::track(newsMessageArea), _1));
The wrapper signals::track would expect a shared_ptr and transport a weak_ptr. The information could be collected with visit_each just like it is done now and the number of trackable objects would only be limited by boost::bind. I think it is acceptable that the client code must maintain a shared_ptr to the tracked instance, as that's expressing rather well what is happening here (even though it doesn't really share the ownership, it shares information about the object).
That does seem more elegant, although I need to learn more about how boost::trackable and visit_each work to understand how it would be implemented. Is this something you would be willing to code?
Patch attached.
Um, looks like I got it wrong. Fixed version attached.
Your changes are fine with me. I'm going to use protected virtual functions instead of private though, as I find it less confusing (as in "that actually works?", the c++ faq agrees with me!). Also, connected() is missing a return. - -- Frank -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFFw1LW5vihyNWuA4URApilAKChS0ALoL5bH3nmpwloyTtpTXQSvwCeMOP6 hZ8h+2eaBcxD+qsBX/v1JyM= =sO52 -----END PGP SIGNATURE-----