
I just realized you can instantiate fusion vector objects (forgot fusion is about runtime too) So I have this example: struct A { explicit A(int) {} }; struct B { explicit B(int) {} }; struct C { explicit C(int) {} }; class Derived1 { public: Derived1 () : members( A(5), B(5), C(5) ) {} private: const boost::fusion::vector< A, B, C > members; }; All members are constructed with the same argument(s) : 5 Now: 1. I may have 20 members in vector.... Is there a way not to explicitly construct them in the Derived1 ctor 2. Derived3 and Derived7 have the same vector of members. Is there a way, inside Derived3 and 7, to take the vector from Derived1?
----- Original Message ----- From: "Joel Falcou"
To: boost-users@lists.boost.org Subject: Re: [Boost-users] Generating a large number of class member variables: PP vs mpl Date: Tue, 20 Jan 2009 11:25:30 +0100 Hicham Mouline a écrit :
But once I have my mpl::vector or fusion::vector, how do i apply a meta function like for_each to generate the class members automatically.
fusion::vector does generate the members for you.