
Hello, the code below doesn't compile (gcc-3.4.6 on Linux). 'transit in scope not defined' Any glue? Regards, Oliver #include <iostream> #include <stdexcept> #include <boost/mpl/list.hpp> #include <boost/statechart/custom_reaction.hpp> #include <boost/statechart/exception_translator.hpp> #include <boost/statechart/simple_state.hpp> #include <boost/statechart/state_machine.hpp> #include <boost/statechart/transition.hpp> namespace mpl = boost::mpl; namespace sc = boost::statechart; struct EvX : sc::event< EvX > {}; struct EvY : sc::event< EvY > {}; template< typename S > struct X; template< typename S > struct sm : public sc::state_machine< sm< S >, X< S >, std::allocator< void >, sc::exception_translator<>
{ void unconsumed_event( const sc::event_base & ) { throw std::runtime_error( "unknown event!" ); } }; template< typename S > struct Z : public sc::simple_state< Z< S >, sm< S >
{}; template< typename S > struct Y; template< typename S > struct X : public sc::simple_state< X< S >, sm< S >
{ typedef mpl::list< sc::transition< EvY, Y< S > >, sc::custom_reaction< sc::exception_thrown > > reactions; sc::result react( sc::exception_thrown const&) { try { throw; } catch ( std::exception const& e) { return transit< Z< S > >(); } <<=== error catch ( ... ) { return forward_event(); } } }; template< typename S > struct Y : public sc::simple_state< Y< S >, sm< S >
{}; int main() { try { sm< int > fsm; fsm.initiate(); fsm.process_event( EvY() ); fsm.process_event( EvX() ); return 0; } catch ( std::runtime_error const& e) { std::cerr << e.what() << std::endl; } catch (...) { std::cerr << "unhandled exception" << std::endl; } return -1; }