Hi Thomas,
On Thu, Jun 24, 2010 at 11:20 AM, Thomas Heller
The correct answer is: post, m_signal_callback() and m_iosrv.wrap need to be lazy expressions. To achieve that for the first two, you can have a phoenix::function wrapper, for the last one, you can use phoenix::bind (which can be used for the first two as well).
I went for a lazy expression in the meantime, with moderate success.
It works for void() handlers, but as soon as multiple parameters kick
in the originally bound method appears to need additional binding.
I'll have a sample attached.
Here's the lazy function
template <bool CallingBack>
struct slot_wrap_impl {
public:
slot_wrap_impl(Queue<CallingBack> &n_q) : m_q(n_q) {};
template <typename SlotSignature>
struct result {
typedef void type;
};
template <typename SlotSignature>
typename result<SlotSignature>::type
operator()(SlotSignature n_method) const {
using boost::phoenix::if_;
using boost::phoenix::switch_;
using boost::phoenix::case_;
using boost::phoenix::default_;
using boost::phoenix::bind;
std::cout << "binding post...\n";
m_q.post(n_method); // X
std::cout << "post bound" << std::endl;
/*
if (CallingBack) {
m_q.callback();
};
*/
};
private:
Queue<CallingBack> &m_q;
};
I call this in my connector using:
boost::phoenix::function