statechart null in_state_reaction
Hello, I would like to implement a null-op in_state_reaction - The in_state_reaction template requires a action argument whereas the transition to self doesn't - Which is the preferred method ? Thanks Sean
Hi Sean
I would like to implement a null-op in_state_reaction - The in_state_reaction template requires a action argument whereas the transition to self doesn't
It's kind of an oversight that in_state_reaction does not define defaults for its last two template parameters. I'll change that for 1.36 (unfortunately no new functionality can go in 1.35). Usually, a state_machine can ignore an event simply by not defining a reaction for it, which is also the reason why in_state_reaction currently requires a function to execute. However, all ignored events will be handed to state_machine<>::unconsumed_event, which sometimes is not what you want.
Which is the preferred method ?
Since transition to self will always exit and reenter the state, the only correct way is with in_state_reaction. HTH, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
"Andreas Huber"
It's kind of an oversight that in_state_reaction does not define defaults for its last two template parameters. I'll change that for 1.36 (unfortunately no new functionality can go in 1.35).
FWIW, I've changed in_state_reaction accordingly, committed to the SVN trunk. Thanks for your feedback! Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
participants (2)
-
Andreas Huber
-
Sean Kelly