
Stewart, Robert wrote:
Beman Dawes wrote:
BOOST_STATIC_ASSERT predated C++0x static_assert, so it doesn't take advantage of static_assert's message argument when static_assert is available.
It would break too much code to change BOOST_STATIC_ASSERT, but we can add a new macro that does take advantage of C++0x static_assert if available.
+1
+ #ifndef BOOST_NO_STATIC_ASSERT + # define BOOST_STATIC_ASSERT_MSG( B, Msg ) static_assert(B, Msg) + #else + # define BOOST_STATIC_ASSERT_MSG( B, Msg ) BOOST_STATIC_ASSERT( B ) + #endif
The abbreviated "MSG" seems out of place. I realize "BOOST_STATIC_ASSERT_MESSAGE" is very long, but it fits the pattern better. I could make it even worse by suggesting that "BOOST_STATIC_ASSERT_WITH_MESSAGE" would read better, particularly since the message isn't being asserted.
It would be nice to remain consistent boost test practice: BOOST_WARN_MESSAGE(predicate, message) BOOST_CHECK_MESSAGE(predicate, message) BOOST_REQUIRE_MESSAGE(predicate, message) BOOST_STATIC_ASSERT_MESSAGE(predicate, message) and didn't Beman just add a BOOST_ASSERT_MESSAGE(predicate, message) Jeff