|
Boost : |
Subject: Re: [boost] Checking for return type -- BOOST_STATIC_ASSERT?
From: Neil Groves (neil_at_[hidden])
Date: 2009-08-21 06:37:22
<snip>
</snip>
>
>
> #include <boost/mpl/assert.hpp>
>
> int main() {
> BOOST_MPL_ASSERT(( boost::is_same<unsigned,unsigned> )); // Should be ok!
> return 0;
> }
>
> When compiling,
>
>
> /sw/bin/g++-4 -I/usr/local/include -ansi -pedantic -Wall test.cpp
> test.cpp: In function 'int main()':
> test.cpp:4: error: expected primary-expression before 'enum'
> test.cpp:4: error: expected ';' before 'enum'
>
>
> Pre-processing (and smartening up for presentation) we get,
>
> int main() {
> static __const std::size_t mpl_assertion_in_line_4 =
> sizeof( boost::mpl::assertion_failed<false>(
> boost::mpl::assert_arg( (void (*) ( boost::is_same<unsigned,unsigned>
> ))0, 1 ) // <--- ))0,1 ) ????
> )
> ) ; // Should be ok!
> return 0;
> }
>
You should also include <boost/type_traits/is_same.hpp>
Regards,
Neil Groves
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk