
Peter Dimov wrote:
Eric Niebler wrote:
I have a preprocessing task that exceeds my limited abilities. If any PP gurus want to step in and prevent me from hurting myself further, I would be very grateful.
My problem is this: I want to mpl::and_ together a bunch of predicates. mpl::and_ has a limit of 4 arguments. So this is wrong:
mpl::and_< pred1, pred2, pred3, pred4, pred5 >
but this is ok:
mpl::and_< pred1, pred2, pred3, mpl::and_< pred4, pred5 > >
Would folding a predicate sequence using and_ work?
It would, except (a) it would be more expensive at compile time than a PP-based solution, and I have reason to care, and (b) it's semantically not the same, since if I used and_ directly, I get short-circuit evaluation. (b) also makes an mpl::fold-based solution unnecessarily expensive by forcing the instantiation of more predicates than necessary to evaluate the and_. -- Eric Niebler Boost Consulting www.boost-consulting.com