
Alexander Nasonov writes:
What if you have 400? Can mpl::vector or mpl::set contain 400 elements?
'mpl::set' definitely can. Structurally, it's not very different from an "overload set".
I wonder how to create such a huge set. By inserting elements 400 times?
That would be one way.
How much compilation time would it take then?
Depends on the compiler. On my G5, CodeWarrior 9.2 swallowed the following in ~15 sec: typedef copy< range_c<int,0,400> , inserter< set<>, insert<_1,_2> > >::type r;
I'm afraid not. Some overloads library work even on higher numbers (up to 700 on my laptop).
Interesting. How do you generate these in the first place?
typedef overload_set<overloads, range_c<int,1,701> > huge_set; struct overloads contains 700 call operators.
Hand-written?
You can't do much with it. Only special algorithms that is designed with this number in mind and which are supposed to return a moderate amount of element. For example, typical FSM may have 20 states and 30 events, that is, up to 600 transitions. First algorithm to apply to an overload set of transitions is searching for unique states. It should return an overload set with size 20 where each signature contains unique state. 20 is moderate number and can be represented by vector20.
This is how this algorithm can transform transitions into overloads with unique states inside:
in : overload_set<overloads, range_c<int,1,601> > out: overload_set<overloads, vector20< /*...*/> >
Something similar to has_key would be nice too. I have one idea how to imlement fast detection of a given signature but I have to check it.
400 is not a random number. Imagine, you have 20 classes in Shape hierarchy. Intersestion of all of them requires 20x20=400 has_intersection functions.
BTW, I remember Dave mentioned that you generate FSM using mpl::vectorN, with N higher then default 50. How high is N?
~70, IIRC.
Is it a number of transitions?
Yep. -- Aleksey Gurtovoy MetaCommunications Engineering