According to the manual, you have to inherit such states from state_chart::state - not simple_state (see the Tutorial)
struct TopState : simple_state< TopState, Machine > { TopState(void) { int z = outermost_context().unique; cout << z << endl; } };
int main (int argc, char *argv[]) { Machine machine1(1); Machine machine2(2); machine1.initiate(); }
################################################################
When I run this code, I get the following error message when machine1 is initiated:
app: /usr/include/boost/statechart/simple_state.hpp:217: typename Context::inner_context_type::outermost_context_type& boost::statechart::simple_state<MostDerived, Context, InnerInitial, historyMode>::outermost_context() [with MostDerived = TopState, Context = Machine, InnerInitial = boost::mpl::list<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]: Assertion `get_pointer( pContext_ ) != 0' failed.
It is as if the outermost context doesn't exist yet (or hasn't been fully initialized yet?) when the initial state is entered.
Am I doing something wrong?
Thank you for your time, Tim Crews GECO, Inc.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users