
joel falcou wrote:
This looks like a prime candidate for using Expression Templates. Does it already ?
Similar idea ... but a bit simpler due to combination of type erasure. Here is the abridged idea : typedef function<bool()> relation; struct And { And(relation lhs, relation rhs); bool operator()(void); }; relation && (relation lhs, relation rhs) { return And(lhs,rhs); } Same for operator || and operator ^ That allows you to freely combine the three operators. The design of the core is described here: http://www.mpprogramming.com/resources/castordesign.pdf and also covered in this introductory video http://www.mpprogramming.com/cpp/#Videos1.0 The current implementation has some minor differences from what is listed in that doc... as 1.1 uses the new Coroutine facilites. -roshan