Re: [Boost-users] shared_ptr and signals
31 Dec
2008
31 Dec
'08
5:30 p.m.
On Tue Dec 30 12:47 , Steven Watanabe
James C. Sutherland wrote:
Is it possible to use a shared_ptr object in a signal?
I want something like
struct A{ ... void operator()(){ ... } ... }; typedef boost::signal Signal; Signal mySignal;
boost::shared_ptr a( new A() ); mySignal.connect(a);
Wrap the shared_ptr in a function object
struct deref_call { void operator()() const { (*f)(); } boost::shared_ptr f; };
bind can also be used to do this, since shared_ptr can be passed as the "this" argument when binding member functions: boost::shared_ptr a( new A() ); mySignal.connect(boost::bind(&A::operator(), a));
5793
Age (days ago)
5793
Last active (days ago)
0 comments
1 participants
participants (1)
-
Frank Mori Hess