
Hello, I have a base class with a number of derived classes. Derived classes might have large number of private member variables, each with a different type. Some of these derived classes may have identical lists of member names and types. I seem to have 2 possibilities to generate the list of member variables: class Derived1 { ... typedef mpl::vector< Type1, Type2, Type3, Type4, Type5, Type6 > memberTypes; // then try to generate automatically from memberTypes, as: // const Type1& mType1; // const Type2& mType2;... // const Type6& mType6; // with some meta function }; or // use only PP class Derived1 { ... #define MYNAMESPACE_MEMBER_TYPES (Type1)(Type2)(Type3)(Type4)(Type5)(Type6) // use PP macros to generate the members }; Is it possible to generate the members from the mpl::vector<> ? in particular, willing to use the mpl::size meta function will forbid me from using PP... The advantage I think is a cleaner definition of types, and other derived classes may use the same type memberTypes. The code generating the member types could isolated in some user meta function. regards,