
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 17 February 2009, Nat Goodspeed wrote:
Nat Goodspeed wrote:
I want my visitor to detect a bound boost::shared_ptr<anything> and pass the shared_ptr to my new slot_type object's track() method.
Frank, that functionality isn't specific to either boost::trackable or my own Trackable base class. Supposing we can resolve the problem of a bound copy of a shared_ptr (previous message in thread), couldn't the Signals2 library incorporate that logic itself?
I don't view the "dynamically replace bound shared_ptr with weak_ptr in incoming bind functor" idea as viable. But if you mean the general feature of searching for some base class during connect and automatically tracking those objects, that might get added in the future. I would do it strictly as an optional extension though, in seperate headers and only using the library's existing public interfaces. It would add a free function findable by ADL that would look for the trackable base class when connecting, something like: class shared_trackable: public enable_shared_from_this<shared_trackable> {}; namespace bs2 = boost::signals2; template<typename Signal, typename Func> bs2::connection connect(Signal &sig, const Func &f) { typename Signal::slot_type myslot(f); // apply visitor to f here which finds shared_trackable objects // and tracks their owning shared_ptr... shared_trackable_visitor visitor(myslot); visit_each(visitor, f); return sig.connect(myslot); } -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkmcHFQACgkQ5vihyNWuA4XvTACgl0tpUa0XYnvWjJaDCS1HBPn+ tJMAoITCZWlj/046/bklVcnTDgN8q0gi =usvO -----END PGP SIGNATURE-----