
-----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160 Hi! I would like to use mpl to generate code along the following lines (I'm trying to build a reusable library for data processing in a 'pipelined' fashion): // Arg1 and Arg2 are instances of 'stages' providing results to this // stage. F is the function taking as arguments const Arg1::result_type& // and const Arg2::result_type&. template<typename Result, typename F, typename Arg1, typename Arg2> struct stage_2 { ~ typedef Result result_type; ~ Result current_; ~ F f_; ~ Arg1 input1_; ~ Arg2 input2_; ~ stage_2(F f, Arg1 a1, Arg2 a2) : f_(f), input1_(a1), input2_(a2) { } ~ const Result &operator() { ~ current_ = f_(input1_(), input2_()); ~ return current_; ~ } }; The question: is it possible not to write manually separate stage_0, stage_1, stage_2, ... for stages taking as input results from the previous 0, 1, 2, ... stages? == Actually, what I'm trying to design: S1 -> S2 -> S3 -> .. -> Sk -> ..-> Sn ~ \_______________/ This is just a rough sketch; in the bottom line the arrow goes from S2 to Sk. Each stage (S'es in the diagram) provides input to its 'children'. This is akin to UNIX shell pipes, but more powerful in that each stage can have multiple inputs. The catch: data transformation at any stage can produce data type on output different from the one received on input. The stages should (obviously?) be parametrized by the stage result, the types of input data and the data transformation to be performed. My last resort is writing a python script to generate the boiler-plate C++ code from high-level description :) Maybe I'm on the wrong way trying to use mpl? any help is appreciated! Thanks. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCyYKoFtofFpCIfhMRAzVDAJ4lMW79S4QS23ivdsLp5xEw/+G+LwCeODR7 fNweo5iwDBnvCKfUcwX3hGI= =UTnS -----END PGP SIGNATURE-----