pipeline p = stage(f1) | f2 | f3 | ... | fn;
Will construct a pipeline containing n stages.
The implementation is based on a limited version of boost.function as well as on simple expression templates (because we basically construct a representation of the pipeline function without evaluating it). The first function in the pipeline must be stageified - all the subsequent ones are automatically stageified by using operator|(pipeline_stage, F).
Pipeline stages are a strange beast. The pipeline_stage class has two specialization: the base one, which accept two callable F1 and F2 (functors that inherit std::unary_function<> or function pointers) and the limited one where F2 is nulltype. Using these two specialization I'm able to build an arbitrarly complex pipeline_stage:
// ps == pipeline_stage
typeid(stage(f1)|f2|f3|f4)).name() == typeif(ps,F3>,F4>,F5>).name()
Some code has been added recently to deal with the reconstruction of pipeline stages (stage(f1) constructs ps, so stage(f1) | stage(f2) would naturally construct ps,ps > ; this has been modified so that this expression constructs a ps object).
Version 0.4 has some small issues (does not compiles on Windows ; next version will ; pipeline p = stage(f1) cannot be written, due to the lack of a constructor in pipeline), but it works quite well in practice. I added adapters for the cryptographers and the encoders to enable the construction of encryption/decryption pipelines).
You can download the zlib-licenced code -ekogen-v0.4"]from my French speaking blog (scroll to the bottom up to the "annexes" part).
And if you like reading C++, this library will please you - nothing too advanced, everything can be read easily, although I make heavy use of templates.
Enjoy !