
----- Original Message ----- From: "Larry Evans" <cppljevans@suddenlink.net> To: <boost@lists.boost.org> 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:
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