mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-05 07:44:32 +02:00
Introduce BOOST_MPL_AUX_PP_COUNTER to workaround MSVC 7.0+ issue with __LINE__ and Edit & Continue mode (http://thread.gmane.org/gmane.comp.lib.boost.user/23207/)
[SVN r36250]
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include <boost/mpl/aux_/config/gcc.hpp>
|
#include <boost/mpl/aux_/config/gcc.hpp>
|
||||||
#include <boost/mpl/aux_/config/msvc.hpp>
|
#include <boost/mpl/aux_/config/msvc.hpp>
|
||||||
#include <boost/mpl/aux_/config/static_constant.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/mpl/aux_/config/workaround.hpp>
|
||||||
|
|
||||||
#include <boost/preprocessor/cat.hpp>
|
#include <boost/preprocessor/cat.hpp>
|
||||||
@@ -216,7 +217,7 @@ BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
|||||||
#define BOOST_MPL_ASSERT(pred) \
|
#define BOOST_MPL_ASSERT(pred) \
|
||||||
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
||||||
std::size_t \
|
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::assertion_failed<false>( \
|
||||||
boost::mpl::assert_arg( (void (*) pred)0, 1 ) \
|
boost::mpl::assert_arg( (void (*) pred)0, 1 ) \
|
||||||
) \
|
) \
|
||||||
@@ -229,7 +230,7 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
|||||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||||
# define BOOST_MPL_ASSERT_NOT(pred) \
|
# define BOOST_MPL_ASSERT_NOT(pred) \
|
||||||
enum { \
|
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::assertion<false>::failed( \
|
||||||
boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
|
boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
|
||||||
) \
|
) \
|
||||||
@@ -240,7 +241,7 @@ enum { \
|
|||||||
# define BOOST_MPL_ASSERT_NOT(pred) \
|
# define BOOST_MPL_ASSERT_NOT(pred) \
|
||||||
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
||||||
std::size_t \
|
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::assertion_failed<false>( \
|
||||||
boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
|
boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
|
||||||
) \
|
) \
|
||||||
@@ -255,12 +256,12 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
|||||||
|
|
||||||
# if !defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
|
# 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
|
// 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) \
|
# define BOOST_MPL_ASSERT_RELATION_IMPL(counter, x, rel, y) \
|
||||||
enum { BOOST_PP_CAT(mpl_assert_rel_value,__LINE__) = (x rel y) }; \
|
enum { BOOST_PP_CAT(mpl_assert_rel_value,counter) = (x rel y) }; \
|
||||||
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
||||||
std::size_t \
|
std::size_t \
|
||||||
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
, BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
|
||||||
boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,__LINE__)>( \
|
boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,counter)>( \
|
||||||
(boost::mpl::failed ************ ( boost::mpl::assert_relation< \
|
(boost::mpl::failed ************ ( boost::mpl::assert_relation< \
|
||||||
boost::mpl::assert_::relations( sizeof( \
|
boost::mpl::assert_::relations( sizeof( \
|
||||||
boost::mpl::assert_::arg rel boost::mpl::assert_::arg \
|
boost::mpl::assert_::arg rel boost::mpl::assert_::arg \
|
||||||
@@ -272,20 +273,20 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
|||||||
) \
|
) \
|
||||||
/**/
|
/**/
|
||||||
# else
|
# else
|
||||||
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
# define BOOST_MPL_ASSERT_RELATION_IMPL(x, rel, y) \
|
||||||
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
||||||
std::size_t \
|
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::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( \
|
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
||||||
std::size_t \
|
std::size_t \
|
||||||
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
, BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
|
||||||
boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,__LINE__)>( \
|
boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,counter)>( \
|
||||||
boost::mpl::assert_rel_arg( boost::mpl::assert_relation< \
|
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 \
|
, x \
|
||||||
, y \
|
, y \
|
||||||
>() ) \
|
>() ) \
|
||||||
@@ -295,13 +296,17 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
|||||||
/**/
|
/**/
|
||||||
# endif
|
# 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
|
#else // !BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES
|
||||||
|
|
||||||
# if defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
|
# if defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
|
||||||
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
||||||
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
||||||
std::size_t \
|
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::assertion_failed<(x rel y)>( boost::mpl::assert_rel_arg( \
|
||||||
boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))() \
|
boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))() \
|
||||||
) ) \
|
) ) \
|
||||||
@@ -312,7 +317,7 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
|||||||
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
# define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
||||||
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
||||||
std::size_t \
|
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::assertion_failed<(x rel y)>( (boost::mpl::failed ************ ( \
|
||||||
boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))::************))0 ) \
|
boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))::************))0 ) \
|
||||||
) \
|
) \
|
||||||
@@ -326,36 +331,40 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
|||||||
// BOOST_MPL_ASSERT_MSG( (pred<x,...>::value), USER_PROVIDED_MESSAGE, (types<x,...>) )
|
// BOOST_MPL_ASSERT_MSG( (pred<x,...>::value), USER_PROVIDED_MESSAGE, (types<x,...>) )
|
||||||
|
|
||||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202))
|
#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; \
|
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; \
|
using boost::mpl::assert_::types; \
|
||||||
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
|
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
|
||||||
{ return 0; } \
|
{ return 0; } \
|
||||||
} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
|
} BOOST_PP_CAT(mpl_assert_arg,counter); \
|
||||||
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
||||||
std::size_t \
|
std::size_t \
|
||||||
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
, BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
|
||||||
boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
|
boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
|
||||||
) \
|
) \
|
||||||
) \
|
) \
|
||||||
/**/
|
/**/
|
||||||
#else
|
#else
|
||||||
# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
|
# define BOOST_MPL_ASSERT_MSG_IMPL( counter, c, msg, types_ ) \
|
||||||
struct msg; \
|
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_ \
|
static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
|
||||||
{ return 0; } \
|
{ return 0; } \
|
||||||
} BOOST_PP_CAT(mpl_assert_arg,__LINE__); \
|
} BOOST_PP_CAT(mpl_assert_arg,counter); \
|
||||||
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
||||||
std::size_t \
|
std::size_t \
|
||||||
, BOOST_PP_CAT(mpl_assertion_in_line_,__LINE__) = sizeof( \
|
, BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
|
||||||
boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,__LINE__)::assert_arg() ) \
|
boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
|
||||||
) \
|
) \
|
||||||
) \
|
) \
|
||||||
/**/
|
/**/
|
||||||
#endif
|
#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
|
#endif // BOOST_MPL_ASSERT_HPP_INCLUDED
|
||||||
|
26
include/boost/mpl/aux_/config/pp_counter.hpp
Normal file
26
include/boost/mpl/aux_/config/pp_counter.hpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
#ifndef BOOST_MPL_AUX_CONFIG_PP_COUNTER_HPP_INCLUDED
|
||||||
|
#define BOOST_MPL_AUX_CONFIG_PP_COUNTER_HPP_INCLUDED
|
||||||
|
|
||||||
|
// Copyright Aleksey Gurtovoy 2006
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
//
|
||||||
|
// See http://www.boost.org/libs/mpl for documentation.
|
||||||
|
|
||||||
|
// $Source$
|
||||||
|
// $Date$
|
||||||
|
// $Revision$
|
||||||
|
|
||||||
|
#if !defined(BOOST_MPL_AUX_PP_COUNTER)
|
||||||
|
# include <boost/mpl/aux_/config/msvc.hpp>
|
||||||
|
# if BOOST_WORKAROUND(BOOST_MSVC, >= 1300)
|
||||||
|
# define BOOST_MPL_AUX_PP_COUNTER() __COUNTER__
|
||||||
|
# else
|
||||||
|
# define BOOST_MPL_AUX_PP_COUNTER() __LINE__
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // BOOST_MPL_AUX_CONFIG_PP_COUNTER_HPP_INCLUDED
|
Reference in New Issue
Block a user