in 1.43 boost it seems that BOOST_STATIC_ASSERT just allows you to set a boolean, is there some kind of alternative that allows me to display a message also with a compilation error?
MPL has BOOST_MPL_ASSERT_MSG. For instance. using GCC 4.2. with this:
BOOST_MPL_ASSERT_MSG
BOOST_MPL_ASSERT_MSG(false, THIS_DOESNT_WORK, (void));
... leads to:
/path/to/file.cpp:42: error: no matching function for call to 'assertion_failed(mpl_::failed************ (function()::THIS_DOESNT_WORK::************)())'
Have you tried something like:
BOOST_STATIC_ASSERT(sizeof(long) == 64 && "Must have 64-bit long!")
If your compiler supports C ++ 0x static_assert, you can do:
static_assert(sizeof(long) == 64, "Must have 64-bit long!")
Boost 1.47 BOOST_STATIC_ASSERT_MSG. :
BOOST_STATIC_ASSERT_MSG
#include <boost/static_assert.hpp> BOOST_STATIC_ASSERT_MSG(condition, msg)
If C ++ 11 is available or the compiler supports it static_assert(), the error message will be msgstring. Otherwise, the macro is considered asBOOST_STATIC_ASSERT(condition)
static_assert()
msg
BOOST_STATIC_ASSERT(condition)
Source: https://habr.com/ru/post/1754508/More articles:Regular Expression Boundaries and Special Characters - regexDefine the plot in this image - wolfram-mathematicaConvert from byte * to byte [] - c #In any case, is it possible to dynamically free up streaming local storage in the Win32 API? - c ++Используя RMysql dbGetQuery в R, как я могу принуждать строковый тип данных в результирующем наборе? - mysqlAllow only one instance of python script - pythonHand parser poker ... how to write a grammar? - parsingAny possible way to use the Tokyo office in Eclipse? - tokyo-cabinetКак разбудить ПК с PHP скрипт? - phpDate labels overlap when placing multiple ggplot graphs on one page - rAll Articles