Boost logo

Boost Users :

Subject: [Boost-users] Problem compiling a statemachine with "class" instead of "struct"
From: Rudolf Leitgeb (r.leitgeb_at_[hidden])
Date: 2009-02-10 05:55:58


Hi folks,

we have run into an interesting problem when compiling
one of our state machines using the boost state chart templates.

If we instantiate a state like this:

struct Active : public boost::statechart::simple_state< Active,
PRX5StateMachine >
{
        public:
                Active() : m_data("") {}
                ~Active() {}

                std::string & Data() { return m_data;}

                const std::string& Data() const { return m_data; }

        private:
                std::string m_data;
};

and use it in our code, everything compiles fine. As soon as we
change the declaration to

        class Active : public boost::statechart::simple_state< Active,
PRX5StateMachine >

we get massive compiler errors, which look like this:

/usr/include/boost/statechart/simple_state.hpp:832: error: within this
context
/usr/include/boost/statechart/state_machine.hpp:243: error: ‘typedef
struct boost::statechart::detail::rtti_policy
boost::statechart::state_machine<PRX5StateMachine, Active,
std::allocator<void>,
boost::statechart::null_exception_translator>::rtti_policy_type’ is
inaccessible

Is it mandatory to inherit from simple_state via a struct and not from
a class?

Thanks for any inputs on this. On request I post two source
directories which
show the problem.

Cheers,

Rudi


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net