Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2008-07-09 04:33:28


on Wed Jul 09 2008, joaquin-AT-tid.es wrote:

> Hi Daryle
>
> Daryle Walker escribió:
>> Here's what I'm trying (to redo integer_test.cpp)
> [...]
>> BOOST_STATIC_ASSERT
>> ( (boost::is_same<distinct_integral_bit_counts,
>> boost::mpl::list_c<int, 8, 16, 32, 64> >) );
>> }
>>
> I think there are two problems with this:
>
> 1. You're passing a *type* (boost::is_same<...>) to BOOST_STATIC_ASSERT
> when you should be passing a numeric contanst.

Or use BOOST_MPL_ASSERT, which does expect a type and gives better error
messages:

  BOOST_MPL_ASSERT((boost::is_same< ... >));

> Append ::value to the type.
> 2. Even with the correction above the thing won't work because
> is_same<T,Q> checks
> for strict equality of the types T and Q; in your case
> distinct_integral_bit_counts
> is *not* the same type as boost::mpl::list_c<...>, but only has the
> same components.
> You can use boost::mpl::equal to test this:
>
> BOOST_STATIC_ASSERT
> ( (boost::mpl::equal<distinct_integral_bit_counts,
> boost::mpl::list_c<int, 8, 16, 32> >::value) );
> }

  BOOST_MPL_ASSERT((boost::mpl::equal< ... >));

is better

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk