Boost logo

Boost :

From: joaquin_at_[hidden]
Date: 2008-07-09 03:02:10


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. 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) );
}

Other than that, your type_to_digit_count is perfectly lambda-cabable
AFAICS. HTH,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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