lur*_*her 3 c++ debugging boost metaprogramming static-assert
在1.43提升似乎BOOST_STATIC_ASSERT只允许放置一个布尔值,是否有一些替代方案允许我在编译错误上显示消息?
MPL有BOOST_MPL_ASSERT_MSG.例如,使用GCC 4.2.有了这个:
BOOST_MPL_ASSERT_MSG(false, THIS_DOESNT_WORK, (void));
Run Code Online (Sandbox Code Playgroud)
... 结果是:
/path/to/file.cpp:42: error: no matching function for call to
'assertion_failed(mpl_::failed************ (function()::THIS_DOESNT_WORK::************)())'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3853 次 |
| 最近记录: |