Boost logo

Boost Users :

Subject: Re: [Boost-users] [mpl] BOOST_MPL_ASSERT_MSG for static_assert
From: Stefan Näwe (stefan.naewe_at_[hidden])
Date: 2014-07-23 09:30:10


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<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'
>

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

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