|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2006-11-04 18:16:41
Paul Mensonides wrote:
>> -----Original Message-----
>> From: boost-bounces_at_[hidden]
>> [mailto:boost-bounces_at_[hidden]] On Behalf Of Eric Niebler
>
>> 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 > >
>>
>> The challenge, should you choose to accept it, is to write
>> some PP magic that, given a MAKE_PREDICATE(z, n, data) macro
>> and a max arity (which is greater than 4!), generates a
>> properly nested mpl::and_-ing of the predicates.
>
> Do you have a sequence (i.e. a selection) of predicates already or are they all
> "pred1", "pred2", etc.?
The predicates can be generated given an integer. They're not quite as
simple as "pred1" and "pred2" but you can ignore that for the sake of
discussion.
In case it helps, the predicates will all be of the form:
matches<
typename meta::arg_c<basic_expr<Tag, Args1, M>, N>::type
, typename meta::arg_c<basic_expr<Tag, Args2, M>, N>::type
>
where M is a constant (could be passed into the macro as data), and N is
the monotonically increasing index.
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk