ICE cast fixes

[SVN r17209]
This commit is contained in:
Aleksey Gurtovoy
2003-02-04 20:21:36 +00:00
parent 7cd837e2c1
commit ab9463baf1
3 changed files with 19 additions and 17 deletions

View File

@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history. // See http://www.boost.org for updates, documentation, and revision history.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// Copyright (c) 2001-02 // Copyright (c) 2001-03
// Aleksey Gurtovoy // Aleksey Gurtovoy
// //
// Permission to use, copy, modify, distribute and sell this software // Permission to use, copy, modify, distribute and sell this software
@@ -17,12 +17,12 @@
#ifndef BOOST_MPL_AUX_ICE_CAST_HPP_INCLUDED #ifndef BOOST_MPL_AUX_ICE_CAST_HPP_INCLUDED
#define BOOST_MPL_AUX_ICE_CAST_HPP_INCLUDED #define BOOST_MPL_AUX_ICE_CAST_HPP_INCLUDED
#include "boost/config.hpp" #include "boost/mpl/aux_/config/workaround.hpp"
#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \ #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
|| defined(__GNUC__) && __GNUC__ < 3 || BOOST_WORKAROUND(__GNUC__, < 3)
# define BOOST_MPL_AUX_ICE_CAST(T, expr) expr # define BOOST_MPL_AUX_ICE_CAST(T, expr) T(expr)
#elif defined(__MWERKS__) && __MWERKS__ <= 0x3001 #elif BOOST_WORKAROUND(__MWERKS__, <= 0x3001)
# define BOOST_MPL_AUX_ICE_CAST(T, expr) (T)(expr) # define BOOST_MPL_AUX_ICE_CAST(T, expr) (T)(expr)
#else #else
# define BOOST_MPL_AUX_ICE_CAST(T, expr) static_cast<T>(expr) # define BOOST_MPL_AUX_ICE_CAST(T, expr) static_cast<T>(expr)

View File

@@ -20,6 +20,7 @@
#include "boost/mpl/aux_/ice_cast.hpp" #include "boost/mpl/aux_/ice_cast.hpp"
#include "boost/mpl/aux_/void_spec.hpp" #include "boost/mpl/aux_/void_spec.hpp"
#include "boost/mpl/aux_/lambda_support.hpp" #include "boost/mpl/aux_/lambda_support.hpp"
#include "boost/mpl/aux_/config/workaround.hpp"
#include "boost/config.hpp" #include "boost/config.hpp"
namespace boost { namespace boost {
@@ -56,7 +57,11 @@ struct if_
private: private:
// agurt, 02/jan/03: two-step 'type' definition for the sake of aCC // agurt, 02/jan/03: two-step 'type' definition for the sake of aCC
typedef if_c< typedef if_c<
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561))
BOOST_MPL_AUX_VALUE_WKND(C)::value
#else
BOOST_MPL_AUX_ICE_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(C)::value) BOOST_MPL_AUX_ICE_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(C)::value)
#endif
, T1 , T1
, T2 , T2
> almost_type_; > almost_type_;

View File

@@ -17,6 +17,7 @@
#ifndef BOOST_MPL_INTEGRAL_C_HPP_INCLUDED #ifndef BOOST_MPL_INTEGRAL_C_HPP_INCLUDED
#define BOOST_MPL_INTEGRAL_C_HPP_INCLUDED #define BOOST_MPL_INTEGRAL_C_HPP_INCLUDED
#include "boost/mpl/aux_/ice_cast.hpp"
#include "boost/mpl/aux_/config/static_constant.hpp" #include "boost/mpl/aux_/config/static_constant.hpp"
#include "boost/mpl/aux_/config/workaround.hpp" #include "boost/mpl/aux_/config/workaround.hpp"
@@ -45,23 +46,19 @@ struct integral_c
// either // either
#if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 243 #if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 243
private: private:
BOOST_STATIC_CONSTANT(T, next_value = static_cast<T>(N + 1)); BOOST_STATIC_CONSTANT(T, next_value = BOOST_MPL_AUX_ICE_CAST(T, (N + 1)));
BOOST_STATIC_CONSTANT(T, prior_value = static_cast<T>(N - 1)); BOOST_STATIC_CONSTANT(T, prior_value = BOOST_MPL_AUX_ICE_CAST(T, (N - 1)));
public: public:
typedef integral_c<T, next_value> next; typedef integral_c<T, next_value> next;
typedef integral_c<T, prior_value> prior; typedef integral_c<T, prior_value> prior;
#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ #elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
|| BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800)) || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800))
// Borland can't handle the casts, and HP doesn't need them typedef integral_c<T, BOOST_MPL_AUX_ICE_CAST(T, (N + 1))> next;
// because the 2nd template parameter is not T but long typedef integral_c<T, BOOST_MPL_AUX_ICE_CAST(T, (N - 1))> prior;
typedef integral_c<T, N + 1> next;
typedef integral_c<T, N - 1> prior;
#elif BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502))
typedef integral_c<T, static_cast<T>(N + 1)> next;
typedef integral_c<T, static_cast<T>(N - 1)> prior;
#else #else
typedef integral_c<T, static_cast<T>(value + 1)> next; typedef integral_c<T, BOOST_MPL_AUX_ICE_CAST(T, (value + 1))> next;
typedef integral_c<T, static_cast<T>(value - 1)> prior; typedef integral_c<T, BOOST_MPL_AUX_ICE_CAST(T, (value - 1))> prior;
#endif #endif
// enables uniform function call syntax for families of overloaded // enables uniform function call syntax for families of overloaded