Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2005-10-01 19:57:28


"Noel Belcourt" <kbelco_at_[hidden]> writes:

> Let me see if I understand this.
>
> So if I want to perform an element-wise mpl::or operation of two
> sequences (r, p1) and then test the resulting sequence for equivalence
> to the input sequence, something like this should work since as you
> observe below, mpl::equal will compare two sequences and yield a scalar
> boolean.
>
> BOOST_STATIC_ASSERT((
> equal<
> r
> , transform<r,p1,or_<_,_> >::type
> >::type::value
> ));

Yes.

  BOOST_MPL_ASSERT((equal<r, transform<r, p1, or_<_,_> >::type>));

would be nicer and give better messages. And other things might be
much more efficient, e.g.

  
  BOOST_MPL_ASSERT((
      equal_to<
          find<
              zip_view<r,p1>
            , not_equal_to<first<_>,or_<first<_>,second<_> >
>::type
        , end<zip_view<r,p1> >::type
>
  ))

>> Second, you seem to be trying to use the equal algorithm, which
>> operates on sequences, on the results of some invocation of mpl::or_,
>> which does not return a sequence but a scalar bool-valued MPL integral
>> constant.
>
> True, I was confused about this point. So I'll use transform to
> generate a sequence representing the element-wise binary operation and
> then use equal.

Great; good luck!

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net