//
// See http://www.boost.org/libs/mpl for documentation.
-// $Source: /cvsroot/boost/boost/boost/mpl/assert.hpp,v $
-// $Date: 2006/11/10 21:31:19 $
-// $Revision: 1.13.14.6 $
+// $Id: assert.hpp 49267 2008-10-11 06:19:02Z agurtovoy $
+// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $
+// $Revision: 49267 $
#include <boost/mpl/not.hpp>
#include <boost/mpl/aux_/value_wknd.hpp>
#include <boost/mpl/aux_/config/gcc.hpp>
#include <boost/mpl/aux_/config/msvc.hpp>
#include <boost/mpl/aux_/config/static_constant.hpp>
+#include <boost/mpl/aux_/config/pp_counter.hpp>
#include <boost/mpl/aux_/config/workaround.hpp>
#include <boost/preprocessor/cat.hpp>
#include <cstddef>
-#if BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, < 0x600) \
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
|| (BOOST_MPL_CFG_GCC != 0) \
|| BOOST_WORKAROUND(__IBMCPP__, <= 600)
# define BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES
#if BOOST_WORKAROUND(__MWERKS__, < 0x3202) \
|| BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \
- || BOOST_WORKAROUND(__BORLANDC__, < 0x600) \
+ || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
|| BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
# define BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER
#endif
// agurt, 10/nov/06: use enums for Borland (which cannot cope with static constants)
// and GCC (which issues "unused variable" warnings when static constants are used
// at a function scope)
-#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) \
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
|| (BOOST_MPL_CFG_GCC != 0)
# define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr }
#else
#define BOOST_MPL_ASSERT(pred) \
BOOST_MPL_AUX_ASSERT_CONSTANT( \
std::size_t \
- , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
+ , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
boost::mpl::assertion_failed<false>( \
boost::mpl::assert_arg( (void (*) pred)0, 1 ) \
) \
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# define BOOST_MPL_ASSERT_NOT(pred) \
enum { \
- BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
+ BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
boost::mpl::assertion<false>::failed( \
boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
) \
# define BOOST_MPL_ASSERT_NOT(pred) \
BOOST_MPL_AUX_ASSERT_CONSTANT( \
std::size_t \
- , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
+ , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
boost::mpl::assertion_failed<false>( \
boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
) \
# if !defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
// agurt, 9/nov/06: 'enum' below is a workaround for gcc 4.0.4/4.1.1 bugs #29522 and #29518
-# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
-enum { BOOST_PP_CAT(mpl_assert_rel_value,__LINE__) = (x rel y) }; \
+# define BOOST_MPL_ASSERT_RELATION_IMPL(counter, x, rel, y) \
+enum { BOOST_PP_CAT(mpl_assert_rel_value,counter) = (x rel y) }; \
BOOST_MPL_AUX_ASSERT_CONSTANT( \
std::size_t \
- , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
- boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,__LINE__)>( \
+ , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
+ boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,counter)>( \
(boost::mpl::failed ************ ( boost::mpl::assert_relation< \
boost::mpl::assert_::relations( sizeof( \
boost::mpl::assert_::arg rel boost::mpl::assert_::arg \
) \
/**/
# else
-# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
+# define BOOST_MPL_ASSERT_RELATION_IMPL(counter, x, rel, y) \
BOOST_MPL_AUX_ASSERT_CONSTANT( \
std::size_t \
- , BOOST_PP_CAT(mpl_assert_rel,__LINE__) = sizeof( \
+ , BOOST_PP_CAT(mpl_assert_rel,counter) = sizeof( \
boost::mpl::assert_::arg rel boost::mpl::assert_::arg \
) \
); \
-BOOST_MPL_AUX_ASSERT_CONSTANT( bool, BOOST_PP_CAT(mpl_assert_rel_value,__LINE__) = (x rel y) ); \
+BOOST_MPL_AUX_ASSERT_CONSTANT( bool, BOOST_PP_CAT(mpl_assert_rel_value,counter) = (x rel y) ); \
BOOST_MPL_AUX_ASSERT_CONSTANT( \
std::size_t \
- , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
- boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,__LINE__)>( \
+ , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
+ boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,counter)>( \
boost::mpl::assert_rel_arg( boost::mpl::assert_relation< \
- boost::mpl::assert_::relations(BOOST_PP_CAT(mpl_assert_rel,__LINE__)) \
+ boost::mpl::assert_::relations(BOOST_PP_CAT(mpl_assert_rel,counter)) \
, x \
, y \
>() ) \
/**/
# endif
+# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
+BOOST_MPL_ASSERT_RELATION_IMPL(BOOST_MPL_AUX_PP_COUNTER(), x, rel, y) \
+/**/
+
#else // !BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES
# if defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
BOOST_MPL_AUX_ASSERT_CONSTANT( \
std::size_t \
- , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
+ , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
boost::mpl::assertion_failed<(x rel y)>( boost::mpl::assert_rel_arg( \
boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))() \
) ) \
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
BOOST_MPL_AUX_ASSERT_CONSTANT( \
std::size_t \
- , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
+ , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
boost::mpl::assertion_failed<(x rel y)>( (boost::mpl::failed ************ ( \
boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))::************))0 ) \
) \
// BOOST_MPL_ASSERT_MSG( (pred<x,...>::value), USER_PROVIDED_MESSAGE, (types<x,...>) )
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202))
-# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
+# define BOOST_MPL_ASSERT_MSG_IMPL( counter, c, msg, types_ ) \
struct msg; \
-typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
+typedef struct BOOST_PP_CAT(msg,counter) : boost::mpl::assert_ \
{ \
using boost::mpl::assert_::types; \
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
{ return 0; } \
-} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
+} BOOST_PP_CAT(mpl_assert_arg,counter); \
BOOST_MPL_AUX_ASSERT_CONSTANT( \
std::size_t \
- , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
- boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
+ , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
+ boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
) \
) \
/**/
#else
-# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
+# define BOOST_MPL_ASSERT_MSG_IMPL( counter, c, msg, types_ ) \
struct msg; \
-typedef struct BOOST_PP_CAT(msg,__LINE__) : boost::mpl::assert_ \
+typedef struct BOOST_PP_CAT(msg,counter) : boost::mpl::assert_ \
{ \
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
{ return 0; } \
-} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
+} BOOST_PP_CAT(mpl_assert_arg,counter); \
BOOST_MPL_AUX_ASSERT_CONSTANT( \
std::size_t \
- , BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
- boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
+ , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
+ boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
) \
) \
/**/
#endif
+#define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
+BOOST_MPL_ASSERT_MSG_IMPL( BOOST_MPL_AUX_PP_COUNTER(), c, msg, types_ ) \
+/**/
+
#endif // BOOST_MPL_ASSERT_HPP_INCLUDED