[StateChart] How to fix "the outer state does not have inner states."

Following code can NOT be compiled successfully, according the comment in
boost source code I note that the compiler complains the outer state does
not have inner state. I want to know how to indicate one state have a inner
state, if it didn't have a initial state? Thanks!
#include

#include
#include namespace fsm = boost::statechart; class HandlingFileState; class PlayerFsm : public fsm::state_machine< PlayerFsm, HandlingFileState > {}; class HandlingFileState: public fsm::state< HandlingFileState, PlayerFsm/*, PlayingState*/> //if the initial state is uncoment, it can be compiled success. But I don't want this. {};
class NormalPlayingState; class PlayingState: public fsm::state< PlayingState, HandlingFileState, NormalPlayingState > {};
class NormalPlayingState: public fsm::state< NormalPlayingState, PlayingState> {};
You declared HandlingFileState as the direct outer state of PlayingState. So you *have to* declare PlayingState as a direct inner state of HandlingFileState. Otherwise your scheme is not consistent -- and StateChart catches this inconsistency in compile-time.
participants (2)
-
Igor R
-
Zhu Bicen