$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r59588 - sandbox/msm/boost/msm/back
From: christophe.j.henry_at_[hidden]
Date: 2010-02-08 15:48:17
Author: chenry
Date: 2010-02-08 15:48:16 EST (Mon, 08 Feb 2010)
New Revision: 59588
URL: http://svn.boost.org/trac/boost/changeset/59588
Log:
added support for a less-compile policy
Added:
   sandbox/msm/boost/msm/back/default_compile_policy.hpp   (contents, props changed)
   sandbox/msm/boost/msm/back/favor_compile_time.hpp   (contents, props changed)
Text files modified: 
   sandbox/msm/boost/msm/back/dispatch_table.hpp |     2                                         
   sandbox/msm/boost/msm/back/state_machine.hpp  |   113 +++++++++++---------------------------- 
   2 files changed, 34 insertions(+), 81 deletions(-)
Added: sandbox/msm/boost/msm/back/default_compile_policy.hpp
==============================================================================
--- (empty file)
+++ sandbox/msm/boost/msm/back/default_compile_policy.hpp	2010-02-08 15:48:16 EST (Mon, 08 Feb 2010)
@@ -0,0 +1,24 @@
+// Copyright 2008 Christophe Henry
+// henry UNDERSCORE christophe AT hotmail DOT com
+// This is an extended version of the state machine available in the boost::mpl library
+// Distributed under the same license as the original.
+// Copyright for the original version:
+// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
+// under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_MSM_BACK_DEFAULT_COMPILE_POLICY_HPP
+#define BOOST_MSM_BACK_DEFAULT_COMPILE_POLICY_HPP
+
+#include <boost/mpl/bool.hpp>
+
+namespace boost { namespace msm { namespace back
+{
+struct favor_runtime_speed 
+{
+	typedef ::boost::mpl::true_ add_forwarding_rows;
+};
+
+}}}// boost::msm::back
+#endif // BOOST_MSM_BACK_DEFAULT_COMPILE_POLICY_HPP
Modified: sandbox/msm/boost/msm/back/dispatch_table.hpp
==============================================================================
--- sandbox/msm/boost/msm/back/dispatch_table.hpp	(original)
+++ sandbox/msm/boost/msm/back/dispatch_table.hpp	2010-02-08 15:48:16 EST (Mon, 08 Feb 2010)
@@ -29,7 +29,7 @@
 // Generates a singleton runtime lookup table that maps current state
 // to a function that makes the SM take its transition on the given
 // Event type.
-template <class Fsm,class Stt, class Event>
+template <class Fsm,class Stt, class Event,class CompilePolicy>
 struct dispatch_table
 {
  private:
Added: sandbox/msm/boost/msm/back/favor_compile_time.hpp
==============================================================================
--- (empty file)
+++ sandbox/msm/boost/msm/back/favor_compile_time.hpp	2010-02-08 15:48:16 EST (Mon, 08 Feb 2010)
@@ -0,0 +1,273 @@
+// Copyright 2008 Christophe Henry
+// henry UNDERSCORE christophe AT hotmail DOT com
+// This is an extended version of the state machine available in the boost::mpl library
+// Distributed under the same license as the original.
+// Copyright for the original version:
+// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
+// under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_MSM_BACK_FAVOR_COMPILE_TIME_H
+#define BOOST_MSM_BACK_FAVOR_COMPILE_TIME_H
+
+#include <utility>
+#include <deque>
+
+#include <boost/mpl/filter_view.hpp>
+#include <boost/mpl/for_each.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/any.hpp>
+
+#include <boost/msm/common.hpp>
+#include <boost/msm/back/metafunctions.hpp>
+#include <boost/msm/back/common_types.hpp>
+#include <boost/msm/back/dispatch_table.hpp>
+
+namespace boost { namespace msm { namespace back 
+{
+template <class Fsm>
+struct process_any_event_helper
+{
+	process_any_event_helper(msm::back::HandledEnum& res_,Fsm* self_,::boost::any any_event_):
+	res(res_),self(self_),any_event(any_event_),finished(false){}
+	template <class Event>
+	void operator()(boost::msm::wrap<Event> const&)
+	{
+		if ( ! finished && ::boost::any_cast<Event>(&any_event)!=0)
+		{
+			finished = true;
+			res = self->process_event(::boost::any_cast<Event>(any_event));
+		}
+	}
+private:
+	msm::back::HandledEnum&		res;
+	Fsm*						self;
+	::boost::any			    any_event;
+	bool						finished;
+};
+
+#define BOOST_MSM_BACK_GENERATE_PROCESS_EVENT(fsmname)												\
+    namespace boost { namespace msm { namespace back{                                               \
+    template<>                                                                                      \
+	::boost::msm::back::HandledEnum fsmname::process_any_event( ::boost::any const& any_event)		\
+	{																								\
+		typedef ::boost::msm::back::recursive_get_transition_table<fsmname>::type stt;				\
+		typedef ::boost::msm::back::generate_event_set<stt>::type all_events;						\
+		::boost::msm::back::HandledEnum res= ::boost::msm::back::HANDLED_FALSE;						\
+		::boost::mpl::for_each<all_events, ::boost::msm::wrap< ::boost::mpl::placeholders::_1> >	\
+		(::boost::msm::back::process_any_event_helper<fsmname>(res,this,any_event));				\
+		return res;																					\
+	}                                                                                               \
+    }}}
+
+struct favor_compile_time 
+{
+	typedef ::boost::mpl::false_ add_forwarding_rows;
+};
+
+// Generates a singleton runtime lookup table that maps current state
+// to a function that makes the SM take its transition on the given
+// Event type.
+template <class Fsm,class Stt, class Event>
+struct dispatch_table < Fsm, Stt, Event, ::boost::msm::back::favor_compile_time>
+{
+ private:
+    // This is a table of these function pointers.
+    typedef HandledEnum (*cell)(Fsm&, int,int,Event const&);
+    typedef bool (*guard)(Fsm&, Event const&);
+
+    // Compute the maximum state value in the sm so we know how big
+    // to make the table
+    typedef typename generate_state_set<Stt>::type state_list;
+    BOOST_STATIC_CONSTANT(int, max_state = ( ::boost::mpl::size<state_list>::value));
+
+	struct chain_row 
+	{
+		HandledEnum operator()(Fsm& fsm, int region,int state,Event const& evt) const
+		{
+			HandledEnum res = HANDLED_FALSE;
+			typename std::deque<cell>::const_iterator it = one_state.begin();
+			while (it != one_state.end() && res != HANDLED_TRUE)
+			{
+				HandledEnum handled = (*it)(fsm,region,state,evt);
+				res = ((HANDLED_GUARD_REJECT==handled) || (HANDLED_GUARD_REJECT==res))?
+					  HANDLED_GUARD_REJECT:handled;
+				++it;
+			}
+			return res;
+		}
+		std::deque<cell> one_state;
+	};
+    template <class TransitionState>
+    static HandledEnum call_submachine(Fsm& fsm, int region, int state, Event const& evt)
+    {
+        return (fsm.template get_state<TransitionState&>()).process_any_event( ::boost::any(evt));
+    }
+    // A function object for use with mpl::for_each that stuffs
+    // transitions into cells.
+    struct init_cell
+    {
+        init_cell(dispatch_table* self_)
+          : self(self_)
+        {}
+        // version for transition event not base of our event
+        template <class Transition>
+        void init_event_base_case(Transition const&, ::boost::mpl::true_ const &) const
+        {
+            typedef typename create_stt<Fsm>::type stt; 
+            BOOST_STATIC_CONSTANT(int, state_id = 
+                (get_state_id<stt,typename Transition::current_state_type>::value));
+            self->entries[state_id].one_state.push_front(reinterpret_cast<cell>(&Transition::execute));
+        }
+        // version for transition event base of our event
+        template <class Transition>
+        void init_event_base_case(Transition const&, ::boost::mpl::false_ const &) const
+        {
+            typedef typename create_stt<Fsm>::type stt; 
+            BOOST_STATIC_CONSTANT(int, state_id = 
+                (get_state_id<stt,typename Transition::current_state_type>::value));
+            self->entries[state_id].one_state.push_front(&Transition::execute);
+        }
+        // Cell initializer function object, used with mpl::for_each
+        template <class Transition>
+        typename ::boost::enable_if<typename has_not_real_row_tag<Transition>::type,void >::type
+            operator()(Transition const&,boost::msm::back::dummy<0> = 0) const
+        {
+            // version for not real rows. No problem because irrelevant for process_event
+        }
+        template <class Transition>
+        typename ::boost::disable_if<typename has_not_real_row_tag<Transition>::type,void >::type
+        operator()(Transition const& tr,boost::msm::back::dummy<1> = 0) const
+        {
+            //only if the transition event is a base of our event is the reinterpret_case safe
+            init_event_base_case(tr,
+                ::boost::mpl::bool_< 
+                    ::boost::is_base_of<typename Transition::transition_event,Event>::type::value>() );
+        }
+    
+        dispatch_table* self;
+    };
+
+    // Cell default-initializer function object, used with mpl::for_each
+    // initializes with call_no_transition, defer_transition or default_eventless_transition
+    // variant for non-anonymous transitions
+    template <class EventType,class Enable=void>
+    struct default_init_cell
+    {
+	    default_init_cell(dispatch_table* self_,chain_row* tofill_entries_)
+		    : self(self_),tofill_entries(tofill_entries_)
+	    {}
+		template <bool deferred,bool composite, int some_dummy=0>
+		struct helper
+		{};
+		template <int some_dummy> struct helper<true,false,some_dummy> 
+		{
+			template <class State>
+			static void execute(boost::msm::wrap<State> const&,chain_row* tofill)
+			{
+				typedef typename create_stt<Fsm>::type stt; 
+				BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+				cell call_no_transition = &Fsm::defer_transition;
+				tofill[state_id].one_state.push_back(call_no_transition);
+			}
+		};
+		template <int some_dummy> struct helper<true,true,some_dummy> 
+		{
+			template <class State>
+			static void execute(boost::msm::wrap<State> const&,chain_row* tofill)
+			{
+				typedef typename create_stt<Fsm>::type stt; 
+				BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+				cell call_no_transition = &Fsm::defer_transition;
+				tofill[state_id].one_state.push_back(call_no_transition);
+			}
+		};
+		template <int some_dummy> struct helper<false,true,some_dummy> 
+		{
+			template <class State>
+			static void execute(boost::msm::wrap<State> const&,chain_row* tofill)
+			{
+				typedef typename create_stt<Fsm>::type stt; 
+				BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+				cell call_no_transition = &call_submachine< State >;
+				tofill[state_id].one_state.push_front(call_no_transition);
+			}
+		};
+		template <int some_dummy> struct helper<false,false,some_dummy> 
+		{
+			template <class State>
+			static void execute(boost::msm::wrap<State> const&,chain_row* tofill)
+			{
+				typedef typename create_stt<Fsm>::type stt; 
+				BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+				cell call_no_transition = &Fsm::call_no_transition;
+				tofill[state_id].one_state.push_back(call_no_transition);
+			}
+		};
+		template <class State>
+		void operator()(boost::msm::wrap<State> const& s)
+		{
+			helper<has_state_delayed_event<State,Event>::type::value,
+				   is_composite_state<State>::type::value>::execute(s,tofill_entries);
+		}
+	    dispatch_table* self;
+	    chain_row* tofill_entries;
+    };
+
+    // variant for anonymous transitions
+    template <class EventType>
+    struct default_init_cell<EventType,
+                             typename ::boost::enable_if<
+                                typename is_automatic_event<EventType>::type>::type>
+    {
+	    default_init_cell(dispatch_table* self_,chain_row* tofill_entries_)
+		    : self(self_),tofill_entries(tofill_entries_)
+	    {}
+
+        // this event is a compound one (not a real one, just one for use in event-less transitions)
+        // Note this event cannot be used as deferred!
+	    template <class State>
+        void operator()(boost::msm::wrap<State> const&)
+	    {
+            typedef typename create_stt<Fsm>::type stt; 
+            BOOST_STATIC_CONSTANT(int, state_id = (get_state_id<stt,State>::value));
+            cell call_no_transition = &Fsm::default_eventless_transition;
+            tofill_entries[state_id].one_state.push_back(call_no_transition);
+	    }
+
+	    dispatch_table* self;
+	    chain_row* tofill_entries;
+    };
+
+ public:
+    // initialize the dispatch table for a given Event and Fsm
+    dispatch_table()
+    {
+        // Initialize cells for no transition
+		::boost::mpl::for_each<
+			::boost::mpl::filter_view<
+					Stt, ::boost::is_base_of<transition_event< ::boost::mpl::placeholders::_>, Event> > >
+		(init_cell(this));
+
+	    ::boost::mpl::for_each<
+			typename generate_state_set<Stt>::type, 
+            boost::msm::wrap< ::boost::mpl::placeholders::_1> >
+         (default_init_cell<Event>(this,entries));
+
+    }
+
+    // The singleton instance.
+    static const dispatch_table instance;
+
+ public: // data members
+	 chain_row entries[max_state];
+};
+
+template <class Fsm,class Stt, class Event>
+const boost::msm::back::dispatch_table<Fsm,Stt, Event,favor_compile_time>
+dispatch_table<Fsm,Stt, Event,favor_compile_time>::instance;
+
+}}} // boost::msm::back
+
+#endif //BOOST_MSM_BACK_FAVOR_COMPILE_TIME_H
Modified: sandbox/msm/boost/msm/back/state_machine.hpp
==============================================================================
--- sandbox/msm/boost/msm/back/state_machine.hpp	(original)
+++ sandbox/msm/boost/msm/back/state_machine.hpp	2010-02-08 15:48:16 EST (Mon, 08 Feb 2010)
@@ -41,6 +41,7 @@
 #include <boost/bind.hpp>
 #include <boost/bind/apply.hpp>
 #include <boost/function.hpp>
+#include <boost/any.hpp>
 
 #include <boost/msm/row_tags.hpp>
 #include <boost/msm/back/metafunctions.hpp>
@@ -48,6 +49,7 @@
 #include <boost/msm/back/bind_helpers.hpp>
 #include <boost/msm/back/common_types.hpp>
 #include <boost/msm/back/args.hpp>
+#include <boost/msm/back/default_compile_policy.hpp>
 #include <boost/msm/back/dispatch_table.hpp>
 
 BOOST_MPL_HAS_XXX_TRAIT_DEF(accept_sig)
@@ -73,26 +75,18 @@
 };
 
 // This declares the statically-initialized dispatch_table instance.
-template <class Fsm,class Stt, class Event>
-const boost::msm::back::dispatch_table<Fsm,Stt, Event>
-dispatch_table<Fsm,Stt, Event>::instance;
+template <class Fsm,class Stt, class Event,class CompilePolicy>
+const boost::msm::back::dispatch_table<Fsm,Stt, Event,CompilePolicy>
+dispatch_table<Fsm,Stt, Event,CompilePolicy>::instance;
 
 // library-containing class for state machines.  Pass the actual FSM class as
 // the Concrete parameter.
-template<class Derived,class HistoryPolicy=NoHistory
-#ifdef BOOST_MSVC
-,class WorkaroundVC9=void
-#endif
->
+template<class Derived,class HistoryPolicy=NoHistory,class CompilePolicy=favor_runtime_speed>
 class state_machine : public Derived
 {
 private: 
     typedef boost::msm::back::state_machine<Derived,
-        HistoryPolicy
-#ifdef BOOST_MSVC
-        ,WorkaroundVC9
-#endif
-    >                                               library_sm;
+        HistoryPolicy,CompilePolicy>                library_sm;
 
     typedef ::boost::function<
         execute_return ()>                          transition_fct;
@@ -103,10 +97,7 @@
     typedef bool (*flag_handler)(library_sm&);
 
     // all state machines are friend with each other to allow embedding any of them in another fsm
-    template <class ,class 
-#ifdef BOOST_MSVC
-        ,class 
-#endif
+    template <class ,class , class
     > friend class boost::msm::back::state_machine;
 
     // helper to add, if needed, visitors to all states
@@ -182,6 +173,7 @@
 
  public: 
     // tags
+	//typedef ::boost::mpl::true_	 composite_state;
     typedef int composite_tag;
 
     // in case someone needs to know
@@ -820,6 +812,15 @@
 	    >::type type;
     };
 
+	template <class Table,class Intermediate,class StateType>
+	struct add_forwarding_row_helper
+	{
+		typedef typename generate_event_set<Table>::type all_events;
+		typedef typename ::boost::mpl::fold<
+			all_events, Intermediate,
+			::boost::mpl::push_back< ::boost::mpl::placeholders::_1,
+			frow<StateType, ::boost::mpl::placeholders::_2> > >::type type;
+	};
     // gets the transition table from a composite and make from it a forwarding row
     template <class StateType,class IsComposite>
     struct get_internal_transition_table
@@ -838,12 +839,11 @@
 	    >::type intermediate;
 
         // and add for every event a forwarding row
-        typedef typename generate_event_set<original_table>::type all_events;
-        typedef typename ::boost::mpl::fold<
-            all_events, intermediate,
-            ::boost::mpl::push_back< ::boost::mpl::placeholders::_1,
-                                     frow<StateType, ::boost::mpl::placeholders::_2> > >::type type;
-
+		typedef typename ::boost::mpl::eval_if<
+				typename CompilePolicy::add_forwarding_rows,
+				add_forwarding_row_helper<original_table,intermediate,StateType>,
+				::boost::mpl::identity<intermediate>
+		>::type type;
     };
     template <class StateType>
     struct get_internal_transition_table<StateType, ::boost::mpl::false_ >
@@ -900,9 +900,6 @@
     template<class Event>
     execute_return process_event(Event const& evt)
     {
-        // use this table as if it came directly from the user
-        typedef dispatch_table<library_sm,complete_table,Event> table;
-
         HandledEnum ret_handled=HANDLED_FALSE;
         // if the state machine has terminate or interrupt flags, check them, otherwise skip
         if (is_event_handling_blocked_helper<Event>
@@ -917,7 +914,6 @@
         }
         else
         {
-
             // prepare the next deferred event for handling
             // if one defer is found in the SM, otherwise skip
             handle_defer_helper<library_sm> defer_helper(m_deferred_events_queue);
@@ -1065,11 +1061,7 @@
      };
      public:
      // Construct with the default initial states
-     state_machine<Derived,HistoryPolicy
-#ifdef BOOST_MSVC          
-          ,WorkaroundVC9
-#endif      
-      >()
+     state_machine<Derived,HistoryPolicy,CompilePolicy   >()
              :Derived()
              ,m_events_queue() 
              ,m_deferred_events_queue()
@@ -1088,37 +1080,10 @@
      }
 
      // Construct with the default initial states and some default argument(s)
-#ifdef BOOST_MSVC
-
-#define MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB(z, n, unused) ARG ## n t ## n
-#define MSM_CONSTRUCTOR_HELPER_EXECUTE(z, n, unused)                                \
-        template <BOOST_PP_ENUM_PARAMS(n, class ARG)>                               \
-        state_machine<Derived,HistoryPolicy                                         \
-          ,WorkaroundVC9                                                            \
-        >(BOOST_PP_ENUM(n, MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB, ~ ) )                \
-        :Derived(BOOST_PP_ENUM_PARAMS(n,t))                                         \
-	     ,m_events_queue()                                                          \
-	     ,m_deferred_events_queue()                                                 \
-	     ,m_history()                                                               \
-         ,m_event_processing(false)                                                 \
-         ,m_is_included(false)                                                      \
-         ,m_visitors()                                                              \
-         ,m_substate_list()                                                         \
-     {                                                                              \
-         ::boost::mpl::for_each< seq_initial_states, ::boost::msm::wrap<mpl::placeholders::_1> > \
-                        (init_states(m_states));                                    \
-         m_history.set_initial_states(m_states);                                    \
-         fill_states(this);                                                         \
-     }
-     BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(BOOST_MSM_CONSTRUCTOR_ARG_SIZE,1), MSM_CONSTRUCTOR_HELPER_EXECUTE, ~)
-#undef MSM_CONSTRUCTOR_HELPER_EXECUTE
-#undef MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB
-#else
-
 #define MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB(z, n, unused) ARG ## n t ## n
 #define MSM_CONSTRUCTOR_HELPER_EXECUTE(z, n, unused)                                \
         template <BOOST_PP_ENUM_PARAMS(n, class ARG)>                               \
-        state_machine<Derived,HistoryPolicy                                         \
+        state_machine<Derived,HistoryPolicy,CompilePolicy                           \
         >(BOOST_PP_ENUM(n, MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB, ~ ) )                \
         :Derived(BOOST_PP_ENUM_PARAMS(n,t))                                         \
              ,m_events_queue()                                                          \
@@ -1138,7 +1103,6 @@
 #undef MSM_CONSTRUCTOR_HELPER_EXECUTE
 #undef MSM_CONSTRUCTOR_HELPER_EXECUTE_SUB
 
-#endif
 
 
      // assignment operator using the copy policy to decide if non_copyable, shallow or deep copying is necessary
@@ -1153,11 +1117,7 @@
          }
         return *this;
      }
-     state_machine<Derived,HistoryPolicy
-#ifdef BOOST_MSVC
-         ,WorkaroundVC9
-#endif
-     > 
+     state_machine<Derived,HistoryPolicy,CompilePolicy> 
          (library_sm const& rhs)
          : Derived(rhs)
      {
@@ -1335,7 +1295,7 @@
         void process(Event const& evt)
         {
             // use this table as if it came directly from the user
-            typedef dispatch_table<library_sm,complete_table,Event> table;
+            typedef dispatch_table<library_sm,complete_table,Event,CompilePolicy> table;
             HandledEnum res =
                 table::instance.entries[self->m_states[0]](
                 *self, 0, self->m_states[0], evt);
@@ -1358,7 +1318,7 @@
             static void process(Event const& evt,library_sm* self_,HandledEnum& result_)
             {
                 // use this table as if it came directly from the user
-                typedef dispatch_table<library_sm,complete_table,Event> table;
+                typedef dispatch_table<library_sm,complete_table,Event,CompilePolicy> table;
                 HandledEnum res =
                     table::instance.entries[self_->m_states[region_id::value]](
                     *self_, region_id::value , self_->m_states[region_id::value], evt);
@@ -1380,7 +1340,7 @@
         void process(Event const& evt)
         {
             // use this table as if it came directly from the user
-            typedef dispatch_table<library_sm,complete_table,Event> table;
+            typedef dispatch_table<library_sm,complete_table,Event,CompilePolicy> table;
             In< ::boost::mpl::int_<0> >::template process(evt,self,result);
         }
 
@@ -1392,9 +1352,6 @@
     template<class Event>
     HandledEnum do_process_event(Event const& evt)
     {
-        // use this table as if it came directly from the user
-        typedef dispatch_table<library_sm,complete_table,Event> table;
-
         HandledEnum handled = HANDLED_FALSE;
         // dispatch the event to every region
         region_processing_helper<Derived> helper(this,handled);
@@ -1421,6 +1378,7 @@
     template <class Event>
     void no_action(Event const&){}
 
+	HandledEnum process_any_event( ::boost::any const& evt);
 
 private:
     // composite accept implementation. First calls accept on the composite, then accept on all its active states.
@@ -1628,7 +1586,7 @@
         // State is a sub fsm with exit pseudo states and gets a pointer to this fsm, so it can build a callback
         template <class StateType>
         typename ::boost::enable_if<
-            typename has_exit_pseudo_states<StateType>::type,void >::type
+            typename is_composite_state<StateType>::type,void >::type
         new_state_helper(boost::msm::back::dummy<0> = 0) const
         {
             ::boost::fusion::at_key<StateType>(self->m_substate_list).set_containing_sm(containing_sm);
@@ -1638,7 +1596,7 @@
         template <class StateType>
         typename ::boost::enable_if<
             typename boost::mpl::and_<typename boost::mpl::not_
-                                                    <typename has_exit_pseudo_states<StateType>::type>::type,
+                                                    <typename is_composite_state<StateType>::type>::type,
                                       typename boost::mpl::not_
                                                     <typename is_pseudo_exit<StateType>::type>::type
                    >::type,void>::type
@@ -2104,11 +2062,6 @@
 
     }
 
-
-public:
-
-
-
 private:
     template <class StateType,class Enable=void>
     struct msg_queue_helper 
@@ -2123,7 +2076,7 @@
     {
     };
 
-    template <class Fsm,class Stt, class Event>
+    template <class Fsm,class Stt, class Event, class Compile>
     friend struct dispatch_table;
 
     // data members