|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-01-28 01:10:24
"Jaap Suter" <boost_at_[hidden]> writes:
>> I was trying to use mpl::contains with list_c and it always seems to
>> return mpl::false_.
>
>> For example
>> typedef mpl::list_c< int ,16,8 > mylist;
>> typedef mpl::contains<mylist, mpl::int_<16> >::type tt;
>
> I've run into this issue in the past as well, and I vaguely rememember
> seeing mpl::integral_c<long>'s being used somewhere along the way, instead
> of mpl::integral_c<int>'s as one would expect.
You can
expect that list_c to contain integral_c<int,16> and
integral_c<int,8>, neither of which is the same type as int_<16>. I
suggest you try a predicate like mpl::equal_to<_,_> with find_if:
typedef not_< is_same<
find_if<s,mpl::int_<16>, mpl::equal_to<_,_> >::type
, end<s>::type
> >::type r;
HTH,
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk