|
Boost : |
From: Goran Mitrovic (gmit_at_[hidden])
Date: 2005-07-04 14:25:26
Even though I'm surely not the first one that came up to this, I've got a
feature suggestion for the Static Assert library.
It would probably be nice to have a variation of the macro that has a second
argument with a short description of the problem that caused the assertion.
For example:
...
#elif defined(BOOST_MSVC)
#define BOOST_STATIC_ASSERT2( B, explanation ) \
typedef ::boost::static_assert_test<\
sizeof(::boost::BOOST_JOIN(STATIC_ASSERTION_FAILURE__, explanation)< (bool)(
B ) >)>\
BOOST_JOIN(boost_static_assert_typedef_, __COUNTER__)
...
static_assert(2 > 3, two_not_larger_than_three);
error C2039: 'STATIC_ASSERTION_FAILURE__two_not_larger_than_three' : is not a
member of 'boost'
Comments?
P.S. With the usage of __VA_ARGS__, an implementation that would allow, with
some programmer's discipline, both forms merged together might be done!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk