
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