
Hi Fernando, Boost.Msm instansiates on_entry member function with various events even if your transition never happen. Hence you can't assume that event handler's template palameta "Event" is always the event you set on your transition table. IIUC, this is a MSM spacification. To solve this problem, you can use SFINAE as follows: struct StaringGame : public msm::front::state<> { template <typename Event, typename FSM> void on_entry(Event const& event, FSM& fsm, typename boost:: enable_if<boost::is_same<Event, character_selected> >::type* = 0 ) { std::cout << "entering: StaringGame" << std::endl; std::cout << "event.element(): " << event.element() << std::endl; std::cout << "event typeid: " << typeid(event).name() << std::endl; } template <typename Event, typename FSM> void on_entry(Event const& event, FSM& fsm, typename boost:: disable_if<boost::is_same<Event, character_selected> >::type* = 0 ) { } }; struct StartTurn: public msm::front::state<> { template <typename Event, typename FSM> void on_entry(Event const& event, FSM& fsm, typename boost:: enable_if<boost::is_same<Event, character_selected> >::type* = 0 ) { std::cout << "entering: StartTurn" << std::endl; std::cout << "event.element(): " << event.element() << std::endl; std::cout << "event typeid: " << typeid(event).name() << std::endl; } template <typename Event, typename FSM> void on_entry(Event const& event, FSM& fsm, typename boost:: disable_if<boost::is_same<Event, character_selected> >::type* = 0 ) { } }; Could you try it? Takatoshi Kondo On Thu, May 23, 2013 at 11:05 AM, Fernando Pelliccioni < fpelliccioni@gmail.com> wrote:
Hi,
I have a Main State Machine (state_machine_) and two SubMachines. I want to start the first SubMachine and when it finished I want to start the second SubMachine.
Here is the code.
I have a compile-time error on some States of the second SubMachine.
error: no member named 'element' in 'exit_introduction' std::cout << "event.element(): " << event.element() << std::endl; ~~~~~ ^
This is on state "StaringGame" and according the Transition Table of GameSM, only the event "character_selected" is used. I don't know why is trying to use the event "exit_introduction".
Is this a bug of MSM? Am I doing something wrong?
Thanks and regards, Fernando Pelliccioni.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost