
Jurai,
On Thu, Mar 29, 2012 at 7:07 PM, Juraj Ivančić
wrote: I know how you feel. MSM is an awesome library. Unfortunately compilers tend to disagree :)
I'd say compilers should be blamed for this ;-) (I'm still wondering how it can be that compilers make such a poor use of my 6 cores with hyperthreading when compile a single object file...) Typically, boost forces compiler writers to improve. But yes, that's the deal. MSM handles a lot for you at compile time to get features, the best speed and ease of use at the cost of longer compile time.
Indeed. I am having massive trouble boost.binding the process_event() function, which I call from within a threaded pool like thingy. It was so bad, I had to macro wrapper functions around it. Not even the usual static_cast trick helped. But this is something I can live with, considering all the benefits.
process_event is a template function, which means boost.bind requires you to use a function pointer. If what you mean is generating an event from an asio handler, I usually use the following (simplified) solution (which I plan to add to a coming paper with msm + asio) (from memory, did not try to compile): template <class Fsm> struct handle_write { void operator()(const boost::system::error_code& error) const { if (error) fsm_->process_event(WriteError()); else fsm_->process_event(WriteDone()); } Fsm* fsm_; }; HTH, Christophe