Chapter 5. Questions & Answers
Prev | Part I. User' guide | Next

## Chapter 5. Questions & Answers

Question: on_entry gets as argument, the sent event. What event do I get when the state becomes default-activated (because it is an initial state)?

Answer: To allow you to know that the state was default-activated, MSM generates a boost::msm::InitEvent default event.

Question: Why do I see no call to no_transition in my submachine?

Answer: Because of the priority rule defined by UML. It says that in case of transition conflict, the most inner state has a higher priority. So after asking the inner state, the containing composite has to be also asked to handle the transition and could find a possible transition.

Question: Why do I get a compile error saying the compiler cannot convert to a function ...Fsm::*(some_event)?

Answer: You probably defined a transition triggered by the event some_event, but used a guard/action method taking another event.

Question: Why do I get a compile error saying something like “too few” or “too many” template arguments?

Answer: You probably defined a transition in form of a a_row or g_row where you wanted just a _row or the other way around. With Row, it could mean that you forgot a "none".

Question: Why do I get a very long compile error when I define more than 20 rows in the transition table?

Answer: MSM uses Boost.MPL under the hood and this is the default maximum size. Please define the following 3 macros before including any MSM headers:

    #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
    #define BOOST_MPL_LIMIT_VECTOR_SIZE 30 // or whatever you need
    #define BOOST_MPL_LIMIT_MAP_SIZE 30 // or whatever you need

Question: Why do I get this error: ”error C2977: 'boost::mpl::vector' : too many template arguments”?

Answer: The first possibility is that you defined a transition table as, say, vector17 and have 18 entries. The second is that you have 17 entries and have a composite state. Under the hood, MSM adds a row for every event in the composite transition table. The third one is that you used a mpl::vector without the number of entries but are close to the MPL default of 50 and have a composite, thus pushing you above 50. Then you need mpl/vector60/70….hpp and a mpl/map60/70….hpp

Question: Why do I get a very long compile error when I define more than 10 states in a state machine?

Answer: MSM uses Boost.Fusion under the hood and this is the default maximum size. Please define the following macro before including any MSM headers:

    #define FUSION_MAX_VECTOR_SIZE 20 // or whatever you need

Prev | Up | Next
Compilers corner | Home | Chapter 6. Internals