Boost logo

Boost :

Subject: Re: [boost] [mpl] is there a or_seq like logical metafunction?
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-02-10 13:54:58


----- Original Message -----
From: "Larry Evans" <cppljevans_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, February 10, 2009 7:39 PM
Subject: Re: [boost] [mpl] is there a or_seq like logical metafunction?

>
> On 02/07/09 13:29, vicente.botet wrote:
> [snip]
>> After suggestion of I don't remember who, I have implemented it as
>>
>> /* Calculate the mlp::and_ of a sequence of nullary logical metafunctions.*/
>> template <typename Seq>
>> struct and_seq : boost::is_same<typename mpl::find_if<Seq, mpl::not_<mpl::_> >::type,
>> typename mpl::end<Seq>::type>
>> {};
>>
>>
>> /* Calculate the mlp::or_ of a sequence of nullary logical metafunctions. */
>> template <typename Seq>
>> struct or_seq : mpl::not_<boost::is_same<typename mpl::find_if<Seq, mpl::_>::type,
>> typename mpl::end<Seq>::type>
>> > {};
>>
>>
>> If there are better ways to do that, you don't tink that this must be encapsulated in the library? Why not add these metafunctions in Boost.MPL?
>
> An alternative to using find_if is to use the all_true (and an obvious
> variation, any_true) from the while.cpp in the while.zip in
> the boost vault's variadic_templates directory. all_true uses
> the while_ template, which is briefly described here:
>
> http://sourceforge.net/mailarchive/forum.php?thread_name=gmsgd6%24k2%241%40ger.gmane.org&forum_name=spirit-devel

Thanks to showing that we can get interesting post related to mpl and fusion on the Boost.Spirit mailing list. I will take a look more often from now.

>From these alternatives, who knows which is the better one?

Best,
Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk