[mpl] BOOST_MPL_ASSERT_MSG for static_assert
Hello,
I would like to add some diagnostic messages during compile time,
potentially enumerating one or more types as well.
static_assert is great for simple messages but falls a bit short due
to inability to list types and such.
I wonder if BOOST_MPL_ASSERT_MSG is the right answer, however, I am
getting the following errors:
BOOST_MPL_ASSERT_MSG(
std::is_base_of
Am 23.07.2014 15:04, schrieb Michael Powell:
Hello,
I would like to add some diagnostic messages during compile time, potentially enumerating one or more types as well.
static_assert is great for simple messages but falls a bit short due to inability to list types and such.
I wonder if BOOST_MPL_ASSERT_MSG is the right answer, however, I am getting the following errors:
BOOST_MPL_ASSERT_MSG( std::is_base_of
::value , "requested type is not a node" , (types ) ); 1>i:\source\kingdom software\cppxml\xml\domain\parts\xnode.h(111): warning C4002: too many actual parameters for macro 'BOOST_MPL_ASSERT_MSG'
Try to play preprocessor yourself. How many commas do you count in the invocation of BOOST_MPL_ASSERT_MSG ? Stefan -- ---------------------------------------------------------------- /dev/random says: Useless Invention: Electric dog polisher. python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')" GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9 9666 829B 49C5 9221 27AF
On Wed, Jul 23, 2014 at 8:30 AM, Stefan Näwe
Am 23.07.2014 15:04, schrieb Michael Powell:
Hello,
I would like to add some diagnostic messages during compile time, potentially enumerating one or more types as well.
static_assert is great for simple messages but falls a bit short due to inability to list types and such.
I wonder if BOOST_MPL_ASSERT_MSG is the right answer, however, I am getting the following errors:
BOOST_MPL_ASSERT_MSG( std::is_base_of
::value , "requested type is not a node" , (types ) ); 1>i:\source\kingdom software\cppxml\xml\domain\parts\xnode.h(111): warning C4002: too many actual parameters for macro 'BOOST_MPL_ASSERT_MSG'
Try to play preprocessor yourself. How many commas do you count in the invocation of BOOST_MPL_ASSERT_MSG ?
Good eyes...
BOOST_MPL_ASSERT_MSG(
(std::is_base_of
Stefan -- ---------------------------------------------------------------- /dev/random says: Useless Invention: Electric dog polisher. python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')" GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9 9666 829B 49C5 9221 27AF _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Michael,
You need brackets around 'is_base_of' expression , because there is a colon
in it.
"request type is not a node" has to be changed to be a legal C++ identifier
token as well (
http://www.boost.org/doc/libs/1_55_0/libs/mpl/doc/refmanual/assert-msg.html
).
BOOST_MPL_ASSERT_MSG(
(std::is_base_of
Hello,
I would like to add some diagnostic messages during compile time, potentially enumerating one or more types as well.
static_assert is great for simple messages but falls a bit short due to inability to list types and such.
I wonder if BOOST_MPL_ASSERT_MSG is the right answer, however, I am getting the following errors:
BOOST_MPL_ASSERT_MSG( std::is_base_of
::value , "requested type is not a node" , (types ) ); 1>i:\source\kingdom software\cppxml\xml\domain\parts\xnode.h(111): warning C4002: too many actual parameters for macro 'BOOST_MPL_ASSERT_MSG'
It's an error message, but not the one(s) I am expecting. Do I need to enable something, preprocessor definition, something like that?
Best regards,
Michael Powell _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Krzysztof Jusiak
-
Michael Powell
-
Stefan Näwe