diff --git a/include/boost/sml.hpp b/include/boost/sml.hpp index f25a4784..d4579b9e 100644 --- a/include/boost/sml.hpp +++ b/include/boost/sml.hpp @@ -856,18 +856,8 @@ template struct transitions { template static bool execute(const TEvent &event, SM &sm, TDeps &deps, TSubs &subs, typename SM::state_t ¤t_state) { - return execute_impl(event, sm, deps, subs, current_state); - } - template - static bool execute_impl(const TEvent &event, SM &sm, TDeps &deps, TSubs &subs, typename SM::state_t ¤t_state) { return aux::get(sm.transitions_).execute(event, sm, deps, subs, current_state, typename SM::has_entry_exits{}); } - template - static bool execute_impl(const on_exit<_, TEvent> &event, SM &sm, TDeps &deps, TSubs &subs, - typename SM::state_t ¤t_state) { - aux::get(sm.transitions_).execute(event, sm, deps, subs, current_state, typename SM::has_entry_exits{}); - return false; - } }; template <> struct transitions { @@ -910,6 +900,13 @@ struct transitions_sub, T, Ts...> { sub_sm>::get(&subs).process_event(event, deps, subs); return true; } + template + static bool execute_impl(const back::on_exit<_, TEvent> &event, SM &sm, TDeps &deps, TSubs &subs, + typename SM::state_t ¤t_state) { + sub_sm>::get(&subs).process_event(event, deps, subs); + transitions::execute(event, sm, deps, subs, current_state); + return true; + } }; template struct transitions_sub> { diff --git a/include/boost/sml/back/transitions.hpp b/include/boost/sml/back/transitions.hpp index 35ae046c..5307c70c 100644 --- a/include/boost/sml/back/transitions.hpp +++ b/include/boost/sml/back/transitions.hpp @@ -39,20 +39,8 @@ template struct transitions { template static bool execute(const TEvent& event, SM& sm, TDeps& deps, TSubs& subs, typename SM::state_t& current_state) { - return execute_impl(event, sm, deps, subs, current_state); - } - - template - static bool execute_impl(const TEvent& event, SM& sm, TDeps& deps, TSubs& subs, typename SM::state_t& current_state) { return aux::get(sm.transitions_).execute(event, sm, deps, subs, current_state, typename SM::has_entry_exits{}); } - - template - static bool execute_impl(const on_exit<_, TEvent>& event, SM& sm, TDeps& deps, TSubs& subs, - typename SM::state_t& current_state) { - aux::get(sm.transitions_).execute(event, sm, deps, subs, current_state, typename SM::has_entry_exits{}); - return false; // from bottom to top - } }; template <> @@ -102,6 +90,14 @@ struct transitions_sub, T, Ts...> { sub_sm>::get(&subs).process_event(event, deps, subs); return true; // from top to bottom } + + template + static bool execute_impl(const back::on_exit<_, TEvent>& event, SM& sm, TDeps& deps, TSubs& subs, + typename SM::state_t& current_state) { + sub_sm>::get(&subs).process_event(event, deps, subs); + transitions::execute(event, sm, deps, subs, current_state); + return true; // from bottom to top + } }; /// @brief Event executor on a sub state machine without transition in parent state machine.