|
Boost Users : |
Subject: Re: [Boost-users] [mpl] BOOST_MPL_ASSERT_MSG for static_assert
From: Krzysztof Jusiak (krzysztof_at_[hidden])
Date: 2014-07-23 09:31:26
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<xnode, Node>::value)
, requested_type_is_not_a_node
, (types<node_type>)
);
Kris
On Wed, Jul 23, 2014 at 2:04 PM, Michael Powell <mwpowellhtx_at_[hidden]>
wrote:
> 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<xnode, Node>::value
> , "requested type is not a node"
> , (types<node_type>)
> );
>
> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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