Boost logo

Boost Users :

From: Andy Little (andy_at_[hidden])
Date: 2006-04-21 06:42:50


"rincewind" wrote
> Please tell me why the following fragment prints 0 - I thought it should
> print 1:
>
> typedef mpl::vector_c<int, 1, 2, 3> v1;
> typedef mpl::vector<mpl::int_<1>, mpl::int_<2>, mpl::int_<3> > v2;
> cout << mpl::equal<v1, v2>::value << "\n";

look in the definition of mpl equal <boost/mpl/equal.hpp> and you should be able
to discern the reason:

template<
      typename BOOST_MPL_AUX_NA_PARAM(Sequence1)
    , typename BOOST_MPL_AUX_NA_PARAM(Sequence2)
    , typename Predicate = is_same<_,_>
>
struct equal;

Hint : Try changing the predicate to mpl::equal_to

regards
Andy Little


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