Example on using BOOST_PP_WHILE()

[SVN r12611]
This commit is contained in:
Vesa Karvonen
2002-01-31 21:14:39 +00:00
parent cc15a18bf6
commit b9f6fe1795
2 changed files with 98 additions and 0 deletions

View File

@ -16,7 +16,14 @@
#include <boost/preprocessor/cat.hpp>
/* Use of BOOST_PP_CAT() below allows macro expansion of __LINE__. */
#define STATIC_ASSERT(EXPR)\
typedef char BOOST_PP_CAT(static_assert_,__LINE__)[ (EXPR) ? 1 : -1 ]
STATIC_ASSERT(sizeof(int) <= sizeof(long));
/* This static assert is broken. The __LINE__ is not expanded as desired. */
#define BROKEN_STATIC_ASSERT(EXPR)\
typedef char static_assert_##__LINE__[ (EXPR) ? 1 : -1 ]
BROKEN_STATIC_ASSERT(sizeof(int) <= sizeof(long));