Skip to content

Commit 9167ba4

Browse files
Edvard Vasdalkris-jusiak
authored andcommitted
Change to use combined_mapping
1 parent fde53fe commit 9167ba4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/boost/sml.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,13 +1138,15 @@ template <class T, class TMappings, class TUnexpected>
11381138
struct get_state_mapping {
11391139
using state_mapping = decltype(get_state_mapping_impl<T, TUnexpected>((TMappings *)0));
11401140
using any_state_mapping = decltype(get_state_mapping_impl<_, TUnexpected>((TMappings *)0));
1141-
struct type {
1141+
static constexpr bool has_any_state_mapping = !aux::is_same<any_state_mapping, transitions<TUnexpected>>::value;
1142+
struct combined_mapping {
11421143
template <class TEvent, class TSm, class TDeps, class TSubs>
11431144
constexpr static bool execute(const TEvent& event, TSm& sm, TDeps& deps, TSubs& subs, typename TSm::state_t& current_state) {
11441145
return state_mapping::template execute<TEvent, TSm, TDeps, TSubs>(event, sm, deps, subs, current_state) ||
11451146
any_state_mapping::template execute<TEvent, TSm, TDeps, TSubs>(event, sm, deps, subs, current_state);
11461147
}
11471148
};
1149+
using type = aux::conditional_t<has_any_state_mapping, combined_mapping, state_mapping>;
11481150
};
11491151
template <class S>
11501152
transitions_sub<S> get_sub_state_mapping_impl(...);

0 commit comments

Comments
 (0)