I have to admit that I'm rather new to C++ and Boost Statecharts. I played around a little bit with the Statechart library and wanted to construct some "bigger" statemachines.
I give a very simple example of my problem. Lets assume a statemachine with only one state and a lot of self-transitions. How to construct something like that? Everything above of 20 transitions is rejected by the gcc(4.5.2) compiler ("wrong number of template arguments (21, should be 20)")
Here is some sample code:
#include <boost/statechart/event.hpp>
#include <boost/statechart/state_machine.hpp>
#include <boost/statechart/simple_state.hpp>
#include <boost/statechart/transition.hpp>
#include <iostream>
#include <boost/mpl/list.hpp>
namespace sc = boost::statechart;
struct MyEvent1: sc::event<MyEvent1> {};
struct MyEvent2: sc::event<MyEvent2> {};
//...
struct MyEvent21: sc::event<MyEvent21> {};
struct MyState;
struct Statemachine: sc::state_machine<Statemachine, MyState> {};
struct MyState: sc::simple_state<MyState, Statemachine> {
typedef boost::mpl::list<
sc::transition< MyEvent1, MyState > ,
sc::transition< MyEvent2, MyState > ,
//...
sc::transition< MyEvent21 >
> reactions;
};
int main() {
//..
return 0;
}
Your problem is not actually related to Boost.Statechart, but rather to Boost.MPL, whose typelists you're making use of. From the Boost.MPL docs:
It continues:
So presumably you'll want the following before any
#include
s: