Hi,
on 1.43 boost it seems that BOOST_STATIC_ASSERT just allows to put a boolean value, is there some alternative that allows me to display a message as well on the compile error?
Hi,
on 1.43 boost it seems that BOOST_STATIC_ASSERT just allows to put a boolean value, is there some alternative that allows me to display a message as well on the compile error?
MPL has BOOST_MPL_ASSERT_MSG
. E.g. using GCC 4.2. with this:
BOOST_MPL_ASSERT_MSG(false, THIS_DOESNT_WORK, (void));
... results in:
/path/to/file.cpp:42: error: no matching function for call to
'assertion_failed(mpl_::failed************ (function()::THIS_DOESNT_WORK::************)())'
Have you tried something like:
BOOST_STATIC_ASSERT(sizeof(long) == 64 && "Must have 64-bit long!")
If your compiler supports the C++0x static_assert, you can do:
static_assert(sizeof(long) == 64, "Must have 64-bit long!")