
Thank you Steven, ----- Original Message ----- From: "Steven Watanabe" <watanabesj@gmail.com> To: <boost@lists.boost.org> Sent: Thursday, March 06, 2008 6:24 AM Subject: Re: [boost] [mpl] is there a or_seq like logical metafunction?
AMDG
vicente.botet wrote:
Hello,
I needs calculate the mlp::or_ of a sequence of nullary logical metafunction.
This seams quite simple. I have do the following: <code> template <typename Seq> struct or_seq;
template <typename Seq, long N> struct or_seq_aux : mpl::or_< typename mpl::front<Seq>::type, or_seq<typename mpl::pop_front<Seq>::type>
{};
template <typename Seq> struct or_seq_aux<Seq, 1> : mpl::front<Seq>::type {};
template <typename Seq> struct or_seq : or_seq_aux<Seq, mpl::size<Seq>::value> {}; </code>
Is there a boost or_seq like logical metafunction? Is there a better way to do it?
I would be extremely interested in any suggestions.
not_<is_same<typename find_if<Seq, _>::type, typename end<Seq>::type> >?
In Christ, Steven Watanabe
I have tested your much more compact solution and it works as expected. Here it is with the mpl namespace: 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? _____________________ Vicente Juan Botet Escriba