Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

boost static_assert with message?

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?

like image 286
lurscher Avatar asked Feb 12 '26 19:02

lurscher


1 Answers

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::************)())'
like image 53
Georg Fritzsche Avatar answered Feb 15 '26 09:02

Georg Fritzsche



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!