Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2004-11-24 08:57:15


gast128 <gast128_at_[hidden]> writes:

> David Abrahams <dave <at> boost-consulting.com> writes:
>
>>
>> "gast 128" <gast128 <at> hotmail.com> writes:
>>
>> > First I get not BOOST_MPL_ASSERT compilable on VC 7.1. From the
>> > documentation I could read that it could replace
>> > BOOST_MPL_ASSERT_IS_SAME, but I removed it completely, and switched
>> > back to BOOST_STATIC_ASSERT.
>>
>> Please post the code.
>>
>
>
> That's simple:
>
>
> #include "boost/mpl/assert.hpp"
>
>
> void Testmpl6()
> {
> BOOST_MPL_ASSERT(false); //fails with error C2143: syntax error : missing '}' before '('
> BOOST_MPL_ASSERT((false)); //same error
> }

But neither of those is supposed to work.

    BOOST_MPL_ASSERT((<bool-valued-nullary-metafunction>))

is the only legal way to use this macro. For example,

    BOOST_MPL_ASSERT((boost::mpl::false_))

which of course will fail to compile because the condition is false.

    BOOST_MPL_ASSERT((boost::mpl::true_))

will pass.

If you are replacing BOOST_MPL_ASSERT_IS_SAME(x, y) you need to write:

    BOOST_MPL_ASSERT((boost::is_same<x,y>))

Can you help me to understand what needs to be fixed in the
documentation so that this is clear?

-- 
Dave Abrahams
Boost Consulting
http://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