I have state A , which I would like to unconditionally move to the next state B after completion of constructor A Is it possible?
I tried to dispatch an event from a constructor that does not work, even if it compiles. Thanks.
Edit: Here is what I have tried so far:
struct A : sc::simple_state< A, Active > { public: typedef sc::custom_reaction< EventDoneA > reactions; A() { std::cout << "Inside of A()" << std::endl; post_event( EventDoneA() ); } sc::result react( const EventDoneA & ) { return transit< B >(); } };
This results in the following runtime statement failure:
Assertion failed: get_pointer( pContext_ ) != 0, file /includ e/boost/statechart/simple_state.hpp, line 459
nickb source share