
17 Mar
2006
17 Mar
'06
11:20 p.m.
John Christopher wrote:
Hello, Still reading... Chapter 11 is still a few pages away... Any way, I rewrote the program and I have something much simpler. The vector of types has not changed: typedef boost::mpl::vector
TTypes; but the Functor has a new switch statement that is much easier to maintain. The nnumber of cases in the switch must be the number of elements in the vector of types... Adding new cases is no big deal anyway. switch(i) { case 0: vec.push_back(new boost::mpl::at >::type); break; case 1: vec.push_back(new boost::mpl::at >::type); break; ....
Given its prepetitive nature you could use boost preprocessor library to generate this switch... -delfin