|
Boost : |
From: Mark Rodgers (mark.rodgers_at_[hidden])
Date: 2000-11-15 04:00:59
Yes, I think static asserts should be accepted into Boost. Some
minor comments:
Documentation
- Instead of COMPILE_TIME_ASSERTION_FAILURE<0> it should perhaps be
COMPILE_TIME_ASSERTION_FAILURE<false>. This is what GCC produces,
and the parameter is a bool after all.
- Throughout Example 2 you have RandonAccessIterator. At least you
are consistent, but perhaps s/n/m/ might be in order.
- The reason for the extra parentheses in Example 2 could rate a
mention.
static_assert.hpp
- I think it would be clearer to move BOOST_JOIN to above BOOST_DO_JOIN:
#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
#define BOOST_DO_JOIN2(X, Y) X##Y
- Is BOOST_DO_JOIN2 necessary? The following seems to work for me:
#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
#define BOOST_DO_JOIN( X, Y ) X ## Y
- The lines for the various versions of the BOOST_STATIC_ASSERT macros
are too long. I'd prefer to see something more like
#define BOOST_STATIC_ASSERT( B ) \
typedef \
::boost::ct_assert_test< \
sizeof(::boost::COMPILE_TIME_ASSERTION_FAILURE< ( B ) >) \
> \
BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
- The names should be consistent. If we have BOOST_STATIC_ASSERT, then
I think it should be STATIC_ASSERTION_FAILURE and static_assert_test.
(BTW, I like these names.)
Examples
- Need copyright notices.
- Example 2 is obviously the source for the docs, so shares the
RandonAccessIterator typo.
Mark
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk