Index: boost/msm/back/dispatch_table.hpp =================================================================== --- boost/msm/back/dispatch_table.hpp (revision 73425) +++ boost/msm/back/dispatch_table.hpp (working copy) @@ -216,32 +216,44 @@ // build chaining rows for rows coming from the same state and the current event // first we build a map of sequence for every source // in reverse order so that the frow's are handled first (UML priority) - typedef typename ::boost::mpl::reverse_fold< - // filter on event - ::boost::mpl::filter_view - , Event> >, - // build a map - ::boost::mpl::map<>, - ::boost::mpl::if_< - // if we already have a row on this source state - ::boost::mpl::has_key< ::boost::mpl::placeholders::_1, - transition_source_type< ::boost::mpl::placeholders::_2> >, - // insert a new element in the value type - ::boost::mpl::insert< + typedef ::boost::mpl::if_< + // if we already have a row on this source state + ::boost::mpl::has_key< ::boost::mpl::placeholders::_1, + transition_source_type< ::boost::mpl::placeholders::_2> >, + // insert a new element in the value type + ::boost::mpl::insert< + ::boost::mpl::placeholders::_1, + ::boost::mpl::pair, + ::boost::mpl::push_back< + ::boost::mpl::at< ::boost::mpl::placeholders::_1, + transition_source_type< ::boost::mpl::placeholders::_2> >, + ::boost::mpl::placeholders::_2 > + > >, + // first row on this source state, make a vector with 1 element + ::boost::mpl::insert< ::boost::mpl::placeholders::_1, ::boost::mpl::pair, - ::boost::mpl::push_back< - ::boost::mpl::at< ::boost::mpl::placeholders::_1, - transition_source_type< ::boost::mpl::placeholders::_2> >, - ::boost::mpl::placeholders::_2 > - > >, - // first row on this source state, make a vector with 1 element - ::boost::mpl::insert< - ::boost::mpl::placeholders::_1, - ::boost::mpl::pair, - make_vector< ::boost::mpl::placeholders::_2> > > - > - >::type map_of_row_seq; + make_vector< ::boost::mpl::placeholders::_2> > > + > body; + typedef typename ::boost::mpl::eval_if< + has_evaluation_forward, + typename ::boost::mpl::fold< + // filter on event + ::boost::mpl::filter_view + , Event> >, + // build a map + ::boost::mpl::map<>, + body + >, + typename ::boost::mpl::reverse_fold< + // filter on event + ::boost::mpl::filter_view + , Event> >, + // build a map + ::boost::mpl::map<>, + body + > + >::type map_of_row_seq; // and then build chaining rows for all source states having more than 1 row typedef typename ::boost::mpl::fold< map_of_row_seq,::boost::mpl::vector0<>, Index: boost/msm/back/metafunctions.hpp =================================================================== --- boost/msm/back/metafunctions.hpp (revision 73425) +++ boost/msm/back/metafunctions.hpp (working copy) @@ -64,6 +64,7 @@ BOOST_MPL_HAS_XXX_TRAIT_DEF(activate_deferred_events) BOOST_MPL_HAS_XXX_TRAIT_DEF(wrapped_entry) BOOST_MPL_HAS_XXX_TRAIT_DEF(active_state_switch_policy) +BOOST_MPL_HAS_XXX_TRAIT_DEF(evaluation_forward) namespace boost { namespace msm { namespace back { Index: boost/msm/back/state_machine.hpp =================================================================== --- boost/msm/back/state_machine.hpp (revision 73425) +++ boost/msm/back/state_machine.hpp (working copy) @@ -1004,18 +1004,35 @@ // Note: these are added first because they must have a lesser prio // than the deeper transitions in the sub regions typedef typename StateType::internal_transition_table istt_simulated; - typedef typename ::boost::mpl::fold< - istt_simulated,::boost::mpl::vector0<>, - ::boost::mpl::push_back< ::boost::mpl::placeholders::_1, + + typedef typename ::boost::mpl::eval_if< + has_evaluation_forward, + typename ::boost::mpl::eval_if< + typename CompilePolicy::add_forwarding_rows, + add_forwarding_row_helper,StateType>, + ::boost::mpl::identity<::boost::mpl::vector0<> > + >, + typename ::boost::mpl::fold< + istt_simulated,::boost::mpl::vector0<>, + ::boost::mpl::push_back< ::boost::mpl::placeholders::_1, make_row_tag< ::boost::mpl::placeholders::_2 , StateType> > - >::type intermediate; + > + >::type intermediate; + typedef typename ::boost::mpl::eval_if< + has_evaluation_forward, + typename ::boost::mpl::fold< + istt_simulated,intermediate, + ::boost::mpl::push_back< ::boost::mpl::placeholders::_1, + make_row_tag< ::boost::mpl::placeholders::_2 , StateType> > + >, + // and add for every event a forwarding row + typename ::boost::mpl::eval_if< + typename CompilePolicy::add_forwarding_rows, + add_forwarding_row_helper, + ::boost::mpl::identity + > + >::type type; - // and add for every event a forwarding row - typedef typename ::boost::mpl::eval_if< - typename CompilePolicy::add_forwarding_rows, - add_forwarding_row_helper, - ::boost::mpl::identity - >::type type; }; template struct get_internal_transition_table @@ -1042,7 +1059,10 @@ typedef typename ::boost::mpl::fold, + typename ::boost::mpl::if_< + has_evaluation_forward, + ::boost::mpl::begin< ::boost::mpl::placeholders::_1>, + ::boost::mpl::end< ::boost::mpl::placeholders::_1> >::type, get_internal_transition_table< ::boost::mpl::placeholders::_2, is_composite_state< ::boost::mpl::placeholders::_2> > >