Fixed some config; rationalized # directives, used BOOST_WORKAROUND

[SVN r18227]
This commit is contained in:
Dave Abrahams
2003-04-10 12:45:19 +00:00
parent 2a5b68c117
commit d808e1fff1
2 changed files with 99 additions and 90 deletions

View File

@@ -18,11 +18,15 @@
#define BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED #define BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED
#include "boost/config.hpp" #include "boost/config.hpp"
#include "boost/detail/workaround.hpp"
#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \ #if !defined(BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION)
|| defined(__MWERKS__) && __MWERKS__ < 0x3001 \
&& !defined(BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION) # if BOOST_WORKAROUND(__BORLANDC__, <= 0x561) || BOOST_WORKAROUND(__MWERKS__, < 0x3001)
# define BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION
# define BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION
# endif
#endif #endif
#endif // BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED #endif // BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED

View File

@@ -22,41 +22,42 @@
#include "boost/mpl/aux_/config/msvc_typename.hpp" #include "boost/mpl/aux_/config/msvc_typename.hpp"
#include "boost/mpl/aux_/config/overload_resolution.hpp" #include "boost/mpl/aux_/config/overload_resolution.hpp"
#include "boost/mpl/aux_/config/static_constant.hpp" #include "boost/mpl/aux_/config/static_constant.hpp"
#include "boost/detail/workaround.hpp"
#if !defined(BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION) && (!defined(__GNUC__) || __GNUC__ == 3) #if !defined(BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION) && !BOOST_WORKAROUND(__GNUC__, <= 2)
# if (!defined(BOOST_MSVC) || BOOST_MSVC > 1300) # if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
// the implementation below is based on a USENET newsgroup's posting by // the implementation below is based on a USENET newsgroup's posting by
// Rani Sharoni (comp.lang.c++.moderated, 2002-03-17 07:45:09 PST) // Rani Sharoni (comp.lang.c++.moderated, 2002-03-17 07:45:09 PST)
# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \ # define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \
template< typename T > \ template< typename T > \
boost::mpl::aux::yes_tag \ boost::mpl::aux::yes_tag \
trait##_helper( \ trait##_helper( \
boost::mpl::aux::type_wrapper<T> const volatile* \ boost::mpl::aux::type_wrapper<T> const volatile* \
, boost::mpl::aux::type_wrapper<BOOST_MSVC_TYPENAME T::name>* = 0 \ , boost::mpl::aux::type_wrapper<BOOST_MSVC_TYPENAME T::name>* = 0 \
); \ ); \
\ \
boost::mpl::aux::no_tag \ boost::mpl::aux::no_tag \
trait##_helper(...); \ trait##_helper(...); \
\ \
template< typename T > \ template< typename T > \
struct trait \ struct trait \
{ \ { \
typedef boost::mpl::aux::type_wrapper<T> t_; \ typedef boost::mpl::aux::type_wrapper<T> t_; \
BOOST_STATIC_CONSTANT(bool, value = \ BOOST_STATIC_CONSTANT(bool, value = \
sizeof((trait##_helper)(static_cast<t_*>(0))) \ sizeof((trait##_helper)(static_cast<t_*>(0))) \
== sizeof(boost::mpl::aux::yes_tag) \ == sizeof(boost::mpl::aux::yes_tag) \
); \ ); \
}; \ }; \
/**/ /**/
# else # else
#include "boost/mpl/if.hpp" # include "boost/mpl/if.hpp"
#include "boost/mpl/bool.hpp" # include "boost/mpl/bool.hpp"
#include "boost/preprocessor/cat.hpp" # include "boost/preprocessor/cat.hpp"
// agurt, 11/sep/02: MSVC version, based on a USENET newsgroup's posting by // agurt, 11/sep/02: MSVC version, based on a USENET newsgroup's posting by
// John Madsen (comp.lang.c++.moderated, 1999-11-12 19:17:06 GMT); // John Madsen (comp.lang.c++.moderated, 1999-11-12 19:17:06 GMT);
@@ -86,63 +87,67 @@ struct msvc_is_incomplete<int>
}}} }}}
# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \ # define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \
template< typename T, typename name = ::boost::mpl::aux::has_xxx_tag > \ template< typename T, typename name = ::boost::mpl::aux::has_xxx_tag > \
struct BOOST_PP_CAT(trait,_impl) : T \ struct BOOST_PP_CAT(trait,_impl) : T \
{ \ { \
private: \ private: \
static boost::mpl::aux::no_tag test(void(*)(::boost::mpl::aux::has_xxx_tag)); \ static boost::mpl::aux::no_tag test(void(*)(::boost::mpl::aux::has_xxx_tag)); \
static boost::mpl::aux::yes_tag test(...); \ static boost::mpl::aux::yes_tag test(...); \
\ \
public: \ public: \
BOOST_STATIC_CONSTANT(bool, value = \ BOOST_STATIC_CONSTANT(bool, value = \
sizeof(test(static_cast<void(*)(name)>(0))) \ sizeof(test(static_cast<void(*)(name)>(0))) \
!= sizeof(boost::mpl::aux::no_tag) \ != sizeof(boost::mpl::aux::no_tag) \
); \ ); \
}; \ }; \
\ \
template< typename T > struct trait \ template< typename T > struct trait \
: boost::mpl::if_c< \ : boost::mpl::if_c< \
boost::mpl::aux::msvc_is_incomplete<T>::value \ boost::mpl::aux::msvc_is_incomplete<T>::value \
, boost::mpl::bool_<false> \ , boost::mpl::bool_<false> \
, BOOST_PP_CAT(trait,_impl)<T> \ , BOOST_PP_CAT(trait,_impl)<T> \
>::type \ >::type \
{ \ { \
}; \ }; \
\ \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, void) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, void) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, bool) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, bool) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, char) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, char) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed char) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed char) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned char) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned char) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed short) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed short) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned short) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned short) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed int) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed int) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned int) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned int) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed long) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, signed long) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned long) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, unsigned long) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, float) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, float) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, double) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, double) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, long double) \ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, long double) \
/**/ /**/
# define BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, T) \ # define BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, T) \
template<> struct trait<T> \ template<> struct trait<T> \
{ \ { \
BOOST_STATIC_CONSTANT(bool,value = false); \ BOOST_STATIC_CONSTANT(bool,value = false); \
}; \ }; \
/**/ /**/
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) # if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \ # define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \
BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, wchar_t) \ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \
/**/ BOOST_MPL_AUX_HAS_XXX_TRAIT_SPEC(trait, wchar_t) \
#else /**/
# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \ # else
/**/
#endif # define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, unused) \
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF_(trait, name, unused) \
/**/
# endif
# endif // BOOST_MSVC > 1300 # endif // BOOST_MSVC > 1300
@@ -151,18 +156,18 @@ template<> struct trait<T> \
// agurt, 11/jan/03: signals a stub-only implementation // agurt, 11/jan/03: signals a stub-only implementation
# define BOOST_NO_MPL_AUX_HAS_XXX # define BOOST_NO_MPL_AUX_HAS_XXX
# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, default_value) \ # define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, default_value) \
template< typename T > \ template< typename T > \
struct trait \ struct trait \
{ \ { \
BOOST_STATIC_CONSTANT(bool, value = default_value); \ BOOST_STATIC_CONSTANT(bool, value = default_value); \
}; \ }; \
/**/ /**/
#endif // BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION #endif // BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION
#define BOOST_MPL_HAS_XXX_TRAIT_DEF(name) \ #define BOOST_MPL_HAS_XXX_TRAIT_DEF(name) \
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_##name, name, false) \ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_##name, name, false) \
/**/ /**/
#endif // BOOST_MPL_AUX_HAS_XXX_HPP_INCLUDED #endif // BOOST_MPL_AUX_HAS_XXX_HPP_INCLUDED