meta state machine, process_event need to copy given event
Hello Christophe, I'm a boost msm first time user and I'm attempting to pass an event to my msm that cannot be copied. This event contains a /unique_ptr/ and my goal is to eventually steal it and store it under my msm. However, even with no deferred events, events are /copied/ to an internal queue, in /boost::msm::back::state_machine::do_pre_msg_queue_helper/. I just wanted to know if there was any chance /process_event/ could be overloaded and accept rvalue-ref or if by design, it's absolutely mandatory to copy those events. Many thanks for your great library -- View this message in context: http://boost.2283326.n4.nabble.com/meta-state-machine-process-event-need-to-... Sent from the Boost - Users mailing list archive at Nabble.com.
Hi,
I'm a boost msm first time user and I'm attempting to pass an event to my msm that cannot be copied. This event contains a /unique_ptr/ and my goal is to eventually steal it and store it under my msm.
However, even with no deferred events, events are /copied/ to an internal queue, in /boost::msm::back::state_machine::do_pre_msg_queue_helper/.
This is just the default. If you don't need the message queue (no pseudo exit, no call to process_event within a transition), you can disable it. See (http://www.boost.org/doc/libs/1_57_0/libs/msm/doc/HTML/ch03s02.html#d0e1147). Defining this within the front-end will disable the queue: typedef int no_message_queue; If you still need the queue, I suppose forcing move (by making copy-ctor of the event const-cast the copied-from and then move) would do.
I just wanted to know if there was any chance /process_event/ could be overloaded and accept rvalue-ref or if by design, it's absolutely mandatory to copy those events.
So far, MSM is still C++03 but I'm working on this. I take the idea on the list of stuff to do to move to C++11.
Many thanks for your great library
Thanks :) HTH, Christophe
participants (2)
-
christophe.j.henry@gmail.com
-
SBAM