Boost logo

Boost Users :

Subject: Re: [Boost-users] meta state machine, process_event need to copy given event
From: christophe.j.henry_at_[hidden]
Date: 2015-02-13 01:43:46


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


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