Boost logo

Boost Users :

Subject: Re: [Boost-users] Mixing signals2 and asio mechanism failing
From: Frank Mori Hess (fmh6jj_at_[hidden])
Date: 2013-10-22 16:01:24


On Tue, Oct 22, 2013 at 12:56 PM, ustulation <ustulation_at_[hidden]> wrote:
> oh i see. I did the same thing myself instead of using track_foreign. In my
> case the signal is a private member of a class so it's not directly
> accessible at the site which wants to register a callback. Instead the class
> with the signal has function exposed so i wonder if using track would be
> possible. I did something like this:
>
> boost::signals2::connection ClassWithSignal::registerListener(const
> std::function< void() > &refListener)
> {
> return m_signal.connect(refListener);
> }

You could pass the slot as a slot instead of a std::function:

http://www.boost.org/doc/libs/1_54_0/libs/signals2/example/passing_slots.cpp

or use templates to do perfect forwarding.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net