19 Feb 15:48
Re: [signals2][review] The review of the signals2 library (formerly thread_safe_signals) begins today, Nov 1st
Frank Mori Hess <frank.hess <at> nist.gov>
2009-02-19 14:48:21 GMT
2009-02-19 14:48:21 GMT
On Wednesday 18 February 2009, Nat Goodspeed wrote:
> Frank Mori Hess wrote:
> > 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 separate 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>
> > {};
>
> If I understand correctly, we expect the coder to pass to boost::bind()
> a plain pointer, a reference or a weak_ptr to a shared_trackable
> subclass instance. None of those will artificially prolong the life of
> that instance. However, using enable_shared_from_this lets your visitor
> obtain a shared_ptr to pass to slot_type::track(). Yes?
Yes
>
> It's still the case that if the coder passes to boost::bind() an actual
> shared_ptr to the shared_trackable subclass instance, the
> slot_type::track() mechanism becomes irrelevant because the object won't
> die. That might warrant a note in the documentation for this feature.
Yes, that's why I suggested you could have the visitor give a compile error on
finding a shared_ptr<shared_trackable> in the bind functor.
RSS Feed