|
Boost Users : |
Subject: Re: [Boost-users] [RFC] Signals bound to phoenix functions
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2010-06-23 12:50:38
Stephan, hi!
please see my answer below.
On Wed, Jun 23, 2010 at 5:42 PM, Stephan Menzel <stephan.menzel_at_[hidden]>wrote:
> Unless I want to add something. Unfortunately I can't always take
> wrap()s output but have to modify a little. In fact, my Queue needs to
> be templatized as well, modifying the behaviour of the functor. I have
> a template parameter "Calling". When it is true, another function
> shall be called by the functor after the method was posted. Now I
> wanted to do this by phoenix:
>
> template <bool Calling>
> class Queue {
> template<typename Handler>
> void post(Handler n_handler) {
> m_iosrv.post(n_handler);
> };
> ...
> template<typename SlotSignature, typename SlotFunction>
> boost::signals2::connection
> connect(boost::signals2::signal<SlotSignature> &n_signal, SlotFunction
> n_method) {
> return n_signal.connect(
> if_( CallingBack ) [
> post(n_method) , m_signal_callback()
> ] .else_ [
> m_iosrv.wrap( n_method )
> ] );
> };
> ...
>
It is difficult to conclude smth from the code without having a
self-containing example. But my assumption is that in the 'else'-branch your
code does not generate a function object. As far as I can see in the
'if'-branch your code generates a function object using the the
comma-operator (if that operator is overloaded in Phoenix), in the
'else'-branch you just have a normal function call, which is not lazy and
does not return a function-object.
Hope that helps,
Ovanes
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