On Friday 11 September 2009, Frank Mori Hess wrote:
On Thursday 10 September 2009, Monteleone, Nathan wrote:
Is it possible to use slot::track with a tr1::shared_ptr instead of a boost::shared_ptr?
Sorry, not at present. I've thought about it a bit, especially with respect to std::shared_ptr, but haven't gotten around to doing anything about it. It wouldn't be too hard to support some fixed set of shared_ptr types using boost::variant. Maybe an additional slow path that uses heap allocation and some type traits could support unforeseen shared_ptr types.
Oh, and the other solution would be to add yet more template parameters to the signal class (like the SlotFunction = boost::function) to permit the shared_ptr/weak_ptr types to be specified per-signal.
Frank, First of all, thanks for your work on the signals2 library. Ideally I'd like to be able to provide extensions to support more than just the boost/tr1 smart pointer types. OpenThreads/OSG's ref_ptr would be one example. A template parameter couldn't give me that power unless it was a policy, right? For that reason I like your traits idea better. I sympathize with your reluctance to add "yet more" template parameters :) Any idea how other libraries dealing with the whole boost vs. std::tr1 namespace issue? Seems unfortunate to have to add template parameters all over the place for that, but I don't see any other way. Am I making a mistake by using tr1 for the stuff that is in tr1 and boost for everything else? This is also interesting, although it doesn't help with the tr1 namespace woes: http://boost.org/libs/smart_ptr/sp_techniques.html#weak_without_shared The gist of it is that you can make any object support weak_ptr with an internal shared_ptr to itself, with a null_deleter. Might be of interest for people wanting to track a wider variety of objects. -Nathan