
Hi, ----- Original Message ----- From: "David Abrahams" <dave@boost-consulting.com> To: <boost@lists.boost.org> Sent: Monday, April 28, 2008 3:50 AM Subject: Re: [boost] [mpl] is there a or_seq like logical metafunction?
on Fri Mar 07 2008, Steven Watanabe <watanabesj-AT-gmail.com> wrote:
AMDG
Giovanni Piero Deretta wrote:
It seems a perfect application for fold:
template<typename Seq> struct or_seq : mpl::apply< mpl::fold<mpl::_1, mpl::false_, mpl::quote2<mpl::or_> > , Seq > {};
template<typename Seq> struct and_seq : mpl::apply< mpl::fold<mpl::_1, mpl::true_, mpl::quote2<mpl::and_> > , Seq > {};
Not quite, because we want it to short circuit. Not to mention that quote2 will not work on and_ and or_.
Yeah, these should be rewritten in terms of mpl::find. Not sure why mpl::apply was used here either, though maybe I'm missign something.
-- Dave Abrahams Boost Consulting http://boost-consulting.com
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Steven Watanabe suggested also the use of find template <typename Seq> struct or_seq : mpl::not_< boost::is_same<typename mpl::find_if<Seq, mpl::_>::type, typename mpl::end<Seq>::type> > {}; I don't know if people needs things logical metafunctions like or_seq, and_seq could also be the case. I thing that these two logical metafunctions have a place in mpl. What do you thing Aleksey? Best regards _____________________ Vicente Juan Botet Escriba