diff options
Diffstat (limited to '3rdParty/Boost/src/boost/mpl/assert.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/mpl/assert.hpp | 79 |
1 files changed, 74 insertions, 5 deletions
diff --git a/3rdParty/Boost/src/boost/mpl/assert.hpp b/3rdParty/Boost/src/boost/mpl/assert.hpp index acc3954..4d860a4 100644 --- a/3rdParty/Boost/src/boost/mpl/assert.hpp +++ b/3rdParty/Boost/src/boost/mpl/assert.hpp @@ -4,61 +4,65 @@ // Copyright Aleksey Gurtovoy 2000-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. -// $Id: assert.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ -// $Revision: 49267 $ +// $Id$ +// $Date$ +// $Revision$ #include <boost/mpl/not.hpp> #include <boost/mpl/aux_/value_wknd.hpp> #include <boost/mpl/aux_/nested_type_wknd.hpp> #include <boost/mpl/aux_/yes_no.hpp> #include <boost/mpl/aux_/na.hpp> #include <boost/mpl/aux_/adl_barrier.hpp> #include <boost/mpl/aux_/config/nttp.hpp> #include <boost/mpl/aux_/config/dtp.hpp> #include <boost/mpl/aux_/config/gcc.hpp> #include <boost/mpl/aux_/config/msvc.hpp> +#include <boost/mpl/aux_/config/gpu.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 <boost/config.hpp> // make sure 'size_t' is placed into 'std' #include <cstddef> +#if BOOST_WORKAROUND(BOOST_MSVC, == 1700) +#include <boost/mpl/if.hpp> +#endif #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 #endif #if BOOST_WORKAROUND(__MWERKS__, < 0x3202) \ || BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \ || 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__, BOOST_TESTED_AT(0x610)) \ - || (BOOST_MPL_CFG_GCC != 0) + || (BOOST_MPL_CFG_GCC != 0) || (BOOST_MPL_CFG_GPU != 0) # define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr } #else # define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) BOOST_STATIC_CONSTANT(T, expr) #endif BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN struct failed {}; @@ -125,20 +129,50 @@ boost::mpl::aux::weighted_tag<2>::type operator!=( assert_, assert_ ); boost::mpl::aux::weighted_tag<3>::type operator>( assert_, assert_ ); boost::mpl::aux::weighted_tag<4>::type operator>=( assert_, assert_ ); boost::mpl::aux::weighted_tag<5>::type operator<( assert_, assert_ ); boost::mpl::aux::weighted_tag<6>::type operator<=( assert_, assert_ ); template< assert_::relations r, long x, long y > struct assert_relation {}; #endif +#if BOOST_WORKAROUND(BOOST_MSVC, == 1700) + +template<class Pred> +struct extract_assert_pred; + +template<class Pred> +struct extract_assert_pred<void(Pred)> { typedef Pred type; }; + +template<class Pred> +struct eval_assert { + typedef typename extract_assert_pred<Pred>::type P; + typedef typename P::type p_type; + typedef typename ::boost::mpl::if_c<p_type::value, + AUX778076_ASSERT_ARG(assert<false>), + failed ************ P::************ + >::type type; +}; + +template<class Pred> +struct eval_assert_not { + typedef typename extract_assert_pred<Pred>::type P; + typedef typename P::type p_type; + typedef typename ::boost::mpl::if_c<!p_type::value, + AUX778076_ASSERT_ARG(assert<false>), + failed ************ ::boost::mpl::not_<P>::************ + >::type type; +}; + +template< typename T > +T make_assert_arg(); -#if !defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER) +#elif !defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER) template< bool > struct assert_arg_pred_impl { typedef int type; }; template<> struct assert_arg_pred_impl<true> { typedef void* type; }; template< typename P > struct assert_arg_pred { typedef typename P::type p_type; typedef typename assert_arg_pred_impl< p_type::value >::type type; }; @@ -205,18 +239,51 @@ typename assert_arg_type_impl< false,assert_relation<r,x,y> >::type assert_rel_arg( assert_relation<r,x,y> ); # endif #endif // BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER #undef AUX778076_ASSERT_ARG BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +#if BOOST_WORKAROUND(BOOST_MSVC, == 1700) + +// BOOST_MPL_ASSERT((pred<x,...>)) + +#define BOOST_MPL_ASSERT(pred) \ +BOOST_MPL_AUX_ASSERT_CONSTANT( \ + std::size_t \ + , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \ + boost::mpl::assertion_failed<false>( \ + boost::mpl::make_assert_arg< \ + typename boost::mpl::eval_assert<void pred>::type \ + >() \ + ) \ + ) \ + ) \ +/**/ + +// BOOST_MPL_ASSERT_NOT((pred<x,...>)) + +#define BOOST_MPL_ASSERT_NOT(pred) \ +BOOST_MPL_AUX_ASSERT_CONSTANT( \ + std::size_t \ + , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \ + boost::mpl::assertion_failed<false>( \ + boost::mpl::make_assert_arg< \ + typename boost::mpl::eval_assert_not<void pred>::type \ + >() \ + ) \ + ) \ + ) \ +/**/ + +#else // BOOST_MPL_ASSERT((pred<x,...>)) #define BOOST_MPL_ASSERT(pred) \ BOOST_MPL_AUX_ASSERT_CONSTANT( \ std::size_t \ , 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 ) \ @@ -244,18 +311,20 @@ BOOST_MPL_AUX_ASSERT_CONSTANT( \ , 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 ) \ ) \ ) \ ) \ /**/ #endif +#endif + // BOOST_MPL_ASSERT_RELATION(x, ==|!=|<=|<|>=|>, y) #if defined(BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES) # 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_IMPL(counter, x, rel, y) \ enum { BOOST_PP_CAT(mpl_assert_rel_value,counter) = (x rel y) }; \ BOOST_MPL_AUX_ASSERT_CONSTANT( \ |