Open magni-mar opened 7 months ago
If you have, say
A
B
and C
B
, sub states are on
and off
C
, sub states are cold
and hot
Then you can determine substates as follows
// in B/on
bool b_on = sm.is<decltype(sml::state<B>)>(sml::state<on>);
// in B/off
bool b_off = sm.is<decltype(sml::state<B>)>(sml::state<off>);
// C/cold
bool b_cold = sm.is<decltype(sml::state<C>)>(sml::state<cold>);
// ...
Never tried this, though:
bool a_cold = sm.is<decltype(sml::state<A>)>(sml::state<cold>);
Here is a minimal sample which one can work from to answer my question:
So I have been looking for a way to determine weather a state is a sub-state machine or not. So far, I have not found a way. In essence, in the above code I want a way to determine weather the outer state machine is currently in a state represented by the inner state machine. So I am looking for some way to be able to do the following: