diff --git a/include/boost/type_traits/add_reference.hpp b/include/boost/type_traits/add_reference.hpp index 5d2cfcb..a5a0a40 100644 --- a/include/boost/type_traits/add_reference.hpp +++ b/include/boost/type_traits/add_reference.hpp @@ -55,17 +55,20 @@ struct add_reference_impl typedef typename result::type type; }; +// these full specialisations are always required: +BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void,void) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void const,void const) +BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void volatile,void volatile) +BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void const volatile,void const volatile) +#endif + } // namespace detail BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,typename detail::add_reference_impl::type) #else -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,T&) - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -// // these full specialisations are always required: BOOST_TT_AUX_TYPE_TRAIT_SPEC1(add_reference,void,void) #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS @@ -74,6 +77,11 @@ BOOST_TT_AUX_TYPE_TRAIT_SPEC1(add_reference,void volatile,void volatile) BOOST_TT_AUX_TYPE_TRAIT_SPEC1(add_reference,void const volatile,void const volatile) #endif +BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,T&) + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + } // namespace boost #include "boost/type_traits/detail/type_trait_undef.hpp" diff --git a/include/boost/type_traits/broken_compiler_spec.hpp b/include/boost/type_traits/broken_compiler_spec.hpp index 4ef151e..87f7548 100644 --- a/include/boost/type_traits/broken_compiler_spec.hpp +++ b/include/boost/type_traits/broken_compiler_spec.hpp @@ -8,6 +8,7 @@ #ifndef BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED #define BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED +#include "boost/mpl/aux_/lambda_support.hpp" #include "boost/config.hpp" #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) @@ -16,19 +17,17 @@ #else -namespace boost { -// forward declarations -template< typename T > struct remove_const; -template< typename T > struct remove_volatile; -template< typename T > struct remove_cv; -template< typename T > struct remove_pointer; -template< typename T > struct remove_reference; -} +namespace boost { namespace detail { +template< typename T > struct remove_const_impl { typedef T type; }; +template< typename T > struct remove_volatile_impl { typedef T type; }; +template< typename T > struct remove_pointer_impl { typedef T type; }; +template< typename T > struct remove_reference_impl { typedef T type; }; +}} -// same as BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1 macro, except that it +// same as BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1 macro, except that it // never gets #undef-ined # define BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(trait,spec,result) \ -template<> struct trait \ +template<> struct trait##_impl \ { \ typedef result type; \ }; \ @@ -39,9 +38,6 @@ template<> struct trait \ BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_const,T const volatile,T volatile) \ BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_volatile,T volatile,T) \ BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_volatile,T const volatile,T const) \ - BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_cv,T const,T) \ - BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_cv,T volatile,T) \ - BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_cv,T const volatile,T) \ /**/ # define BOOST_TT_AUX_REMOVE_PTR_REF_RANK_1_SPEC(T) \ @@ -69,14 +65,14 @@ template<> struct trait \ /**/ # define BOOST_TT_BROKEN_COMPILER_SPEC(T) \ - namespace boost { \ + namespace boost { namespace detail { \ BOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T) \ BOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T) \ BOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T*) \ BOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T const*) \ BOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T volatile*) \ BOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T const volatile*) \ - } \ + }} \ /**/ # include "boost/type_traits/detail/type_trait_undef.hpp" @@ -98,7 +94,7 @@ BOOST_TT_BROKEN_COMPILER_SPEC(signed long) BOOST_TT_BROKEN_COMPILER_SPEC(unsigned long) BOOST_TT_BROKEN_COMPILER_SPEC(float) BOOST_TT_BROKEN_COMPILER_SPEC(double) -BOOST_TT_BROKEN_COMPILER_SPEC(long double) +//BOOST_TT_BROKEN_COMPILER_SPEC(long double) // for backward compatibility #define BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(T) \ diff --git a/include/boost/type_traits/detail/bool_trait_def.hpp b/include/boost/type_traits/detail/bool_trait_def.hpp index 7278dd6..5244160 100644 --- a/include/boost/type_traits/detail/bool_trait_def.hpp +++ b/include/boost/type_traits/detail/bool_trait_def.hpp @@ -87,6 +87,20 @@ template<> struct trait< sp1,sp2 > \ }; \ /**/ +#define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(trait,sp,C) \ +template<> struct trait##_impl< sp > \ +{ \ + BOOST_STATIC_CONSTANT(bool, value = (C)); \ +}; \ +/**/ + +#define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,sp1,sp2,C) \ +template<> struct trait##_impl< sp1,sp2 > \ +{ \ + BOOST_STATIC_CONSTANT(bool, value = (C)); \ +}; \ +/**/ + #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(param,trait,sp,C) \ template< param > struct trait< sp > \ BOOST_TT_AUX_BOOL_C_BASE(C) \ @@ -120,6 +134,13 @@ template< param1, param2 > struct trait< sp1,sp2 > \ }; \ /**/ +#define BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(param,trait,sp1,sp2,C) \ +template< param > struct trait##_impl< sp1,sp2 > \ +{ \ + BOOST_STATIC_CONSTANT(bool, value = (C)); \ +}; \ +/**/ + #ifndef BOOST_NO_CV_SPECIALIZATIONS # define BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(trait,sp,value) \ BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,value) \ diff --git a/include/boost/type_traits/detail/bool_trait_undef.hpp b/include/boost/type_traits/detail/bool_trait_undef.hpp index 2e6e353..d3d957c 100644 --- a/include/boost/type_traits/detail/bool_trait_undef.hpp +++ b/include/boost/type_traits/detail/bool_trait_undef.hpp @@ -22,8 +22,11 @@ #undef BOOST_TT_AUX_BOOL_TRAIT_DEF2 #undef BOOST_TT_AUX_BOOL_TRAIT_SPEC1 #undef BOOST_TT_AUX_BOOL_TRAIT_SPEC2 +#undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1 +#undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2 #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1 #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2 #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1 #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2 +#undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1 #undef BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1 diff --git a/include/boost/type_traits/detail/type_trait_def.hpp b/include/boost/type_traits/detail/type_trait_def.hpp index c64cd19..8bafd72 100644 --- a/include/boost/type_traits/detail/type_trait_def.hpp +++ b/include/boost/type_traits/detail/type_trait_def.hpp @@ -37,6 +37,13 @@ template<> struct trait \ }; \ /**/ +#define BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(trait,spec,result) \ +template<> struct trait##_impl \ +{ \ + typedef result type; \ +}; \ +/**/ + #define BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(param,trait,spec,result) \ template< param > struct trait \ { \ diff --git a/include/boost/type_traits/detail/type_trait_undef.hpp b/include/boost/type_traits/detail/type_trait_undef.hpp index e001dcd..d979005 100644 --- a/include/boost/type_traits/detail/type_trait_undef.hpp +++ b/include/boost/type_traits/detail/type_trait_undef.hpp @@ -18,5 +18,6 @@ #undef BOOST_TT_AUX_TYPE_TRAIT_DEF1 #undef BOOST_TT_AUX_TYPE_TRAIT_SPEC1 +#undef BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1 #undef BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1 #undef BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2 diff --git a/include/boost/type_traits/is_array.hpp b/include/boost/type_traits/is_array.hpp index 72a83b2..b2fb261 100644 --- a/include/boost/type_traits/is_array.hpp +++ b/include/boost/type_traits/is_array.hpp @@ -59,15 +59,16 @@ struct is_array_impl ); }; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_array,void const volatile,false) +#endif + } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_array,T,::boost::detail::is_array_impl::value) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_array,void,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_array,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_array,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_array,void const volatile,false) -#endif #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/include/boost/type_traits/is_const.hpp b/include/boost/type_traits/is_const.hpp index a830737..662715d 100644 --- a/include/boost/type_traits/is_const.hpp +++ b/include/boost/type_traits/is_const.hpp @@ -102,16 +102,17 @@ struct is_const_impl { }; +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_const,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_const,void const,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_const,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_const,void const volatile,true) +#endif + } // namespace detail //* is a type T declared const - is_const BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_const,T,::boost::detail::is_const_impl::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_const,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_const,void const,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_const,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_const,void const volatile,true) -#endif #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/include/boost/type_traits/is_convertible.hpp b/include/boost/type_traits/is_convertible.hpp index a5f46e0..8f90dd8 100644 --- a/include/boost/type_traits/is_convertible.hpp +++ b/include/boost/type_traits/is_convertible.hpp @@ -75,7 +75,7 @@ struct does_conversion_exist }; template -struct is_convertible_impl +struct is_convertible_basic_impl : does_conversion_exist::template result_ { }; @@ -121,7 +121,7 @@ template struct checker }; template -struct is_convertible_impl +struct is_convertible_basic_impl { static From _m_from; static bool const value = sizeof( detail::checker::_m_check(_m_from, 0) ) @@ -145,7 +145,7 @@ struct any_conversion }; template -struct is_convertible_impl +struct is_convertible_basic_impl { static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion ...); static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int); @@ -163,7 +163,7 @@ struct is_convertible_impl // however it does rely on undefined behaviour by passing UDT's through (...). // template -struct is_convertible_impl +struct is_convertible_basic_impl { static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...); static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To); @@ -176,26 +176,20 @@ struct is_convertible_impl #endif // is_convertible_impl +#if !defined(__BORLANDC__) || __BORLANDC__ > 0x551 template -struct is_convertible_forwarder +struct is_convertible_impl { typedef typename add_reference::type ref_type; BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< - ::boost::detail::is_convertible_impl::value, + ::boost::detail::is_convertible_basic_impl::value, ::boost::type_traits::ice_not< ::boost::is_array::value >::value >::value) ); }; - -} // namespace detail - -#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x551) -BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convertible_impl::value)) -#else -BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convertible_forwarder::value)) #endif // @@ -203,25 +197,12 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convert // for void types, these are common to all the // implementation above: // -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename To,is_convertible,void,To,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename From,is_convertible,From,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename To,is_convertible,void const,To,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename To,is_convertible,void volatile,To,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename To,is_convertible,void const volatile,To,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename From,is_convertible,From,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const volatile,false) -#endif -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS # define TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1(trait,spec1,spec2,value) \ - BOOST_TT_AUX_BOOL_TRAIT_SPEC2(trait,spec1,spec2,value) \ - BOOST_TT_AUX_BOOL_TRAIT_SPEC2(trait,spec1,spec2 const,value) \ - BOOST_TT_AUX_BOOL_TRAIT_SPEC2(trait,spec1,spec2 volatile,value) \ - BOOST_TT_AUX_BOOL_TRAIT_SPEC2(trait,spec1,spec2 const volatile,value) \ + BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2,value) \ + BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2 const,value) \ + BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2 volatile,value) \ + BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,spec1,spec2 const volatile,value) \ /**/ # define TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2(trait,spec1,spec2,value) \ @@ -237,9 +218,26 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename From,is_convertible,From,void c # undef TT_AUX_BOOL_CV_VOID_TRAIT_SPEC2_PART1 #else - BOOST_TT_AUX_BOOL_TRAIT_SPEC2(is_convertible,void,void,true) + BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(is_convertible,void,void,true) #endif // BOOST_NO_CV_VOID_SPECIALIZATIONS +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void,To,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const,To,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void volatile,To,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const volatile,To,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const volatile,false) +#endif +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convertible_impl::value)) + #if defined(__GNUC__) @@ -287,5 +285,3 @@ TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(long double) #include "boost/type_traits/detail/bool_trait_undef.hpp" #endif // BOOST_TT_IS_CONVERTIBLE_HPP_INCLUDED - - diff --git a/include/boost/type_traits/is_empty.hpp b/include/boost/type_traits/is_empty.hpp index 4930c0c..1a96022 100644 --- a/include/boost/type_traits/is_empty.hpp +++ b/include/boost/type_traits/is_empty.hpp @@ -188,17 +188,17 @@ template struct is_empty_impl #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +// these help when the compiler has no partial specialization support: +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void const volatile,false) +#endif + } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_empty,T,::boost::detail::is_empty_impl::value) -// these help when the compiler has no partial specialization support: -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_empty,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_empty,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_empty,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_empty,void const volatile,false) -#endif - } // namespace boost diff --git a/include/boost/type_traits/is_enum.hpp b/include/boost/type_traits/is_enum.hpp index 2426773..9392625 100644 --- a/include/boost/type_traits/is_enum.hpp +++ b/include/boost/type_traits/is_enum.hpp @@ -91,22 +91,22 @@ template struct is_enum_impl BOOST_STATIC_CONSTANT(bool, value = helper::value); }; +// Specializations suppress some nasty warnings with GCC +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,float,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,double,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,long double,false) +// these help on compilers with no partial specialization support: +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void const volatile,false) +#endif + } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_enum,T,::boost::detail::is_enum_impl::value) -// Specializations suppress some nasty warnings with GCC -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_enum,float,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_enum,double,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_enum,long double,false) -// these help on compilers with no partial specialization support: -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_enum,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_enum,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_enum,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_enum,void const volatile,false) -#endif - #else // __BORLANDC__ // // buggy is_convertible prevents working diff --git a/include/boost/type_traits/is_member_function_pointer.hpp b/include/boost/type_traits/is_member_function_pointer.hpp index cab7ea4..b2e4218 100644 --- a/include/boost/type_traits/is_member_function_pointer.hpp +++ b/include/boost/type_traits/is_member_function_pointer.hpp @@ -39,18 +39,18 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1( #else -#ifndef __BORLANDC__ - namespace detail { +#ifndef __BORLANDC__ + template -struct is_member_function_pointer_select +struct is_mem_fun_pointer_select : ::boost::type_traits::false_result { }; template <> -struct is_member_function_pointer_select +struct is_mem_fun_pointer_select { template struct result_ { @@ -65,8 +65,8 @@ struct is_member_function_pointer_select }; template -struct is_mem_fun_pointer_impl - : is_member_function_pointer_select< +struct is_member_function_pointer_impl + : is_mem_fun_pointer_select< ::boost::type_traits::ice_or< ::boost::is_reference::value , ::boost::is_array::value @@ -75,14 +75,10 @@ struct is_mem_fun_pointer_impl { }; -} // namespace detail - #else // Borland C++ -namespace detail { - template -struct is_mem_fun_pointer_impl +struct is_member_function_pointer_impl { static T& m_t; BOOST_STATIC_CONSTANT( @@ -91,22 +87,23 @@ struct is_mem_fun_pointer_impl }; template -struct is_mem_fun_pointer_impl +struct is_member_function_pointer_impl { BOOST_STATIC_CONSTANT(bool, value = false); }; +#endif + +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void const volatile,false) +#endif + } // namespace detail -#endif - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_function_pointer,T,::boost::detail::is_mem_fun_pointer_impl::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_member_function_pointer,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_member_function_pointer,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_member_function_pointer,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_member_function_pointer,void const volatile,false) -#endif +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_function_pointer,T,::boost::detail::is_member_function_pointer_impl::value) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/include/boost/type_traits/is_member_pointer.hpp b/include/boost/type_traits/is_member_pointer.hpp index f285d32..0f8851b 100644 --- a/include/boost/type_traits/is_member_pointer.hpp +++ b/include/boost/type_traits/is_member_pointer.hpp @@ -77,15 +77,16 @@ struct is_member_pointer_impl { }; +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void const volatile,false) +#endif + } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,::boost::detail::is_member_pointer_impl::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_member_pointer,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_member_pointer,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_member_pointer,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_member_pointer,void const volatile,false) -#endif #endif // __BORLANDC__ diff --git a/include/boost/type_traits/is_pod.hpp b/include/boost/type_traits/is_pod.hpp index e6e0fff..d478e34 100644 --- a/include/boost/type_traits/is_pod.hpp +++ b/include/boost/type_traits/is_pod.hpp @@ -23,14 +23,14 @@ namespace boost { -// forward declaration, needed by 'is_POD_array_helper' template below +// forward declaration, needed by 'is_pod_array_helper' template below template< typename T > struct is_POD; namespace detail { #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template struct is_POD_impl +template struct is_pod_impl { BOOST_STATIC_CONSTANT( bool, value = @@ -42,15 +42,15 @@ template struct is_POD_impl }; template -struct is_POD_impl - : is_POD_impl +struct is_pod_impl + : is_pod_impl { }; #else template -struct is_POD_helper +struct is_pod_helper { template struct result_ { @@ -77,7 +77,7 @@ struct bool_to_yes_no_type }; template -struct is_POD_array_helper +struct is_pod_array_helper { enum { is_pod = ::boost::is_POD::value }; // MSVC workaround typedef typename bool_to_yes_no_type::type type; @@ -85,10 +85,10 @@ struct is_POD_array_helper }; template -is_POD_array_helper is_POD_array(T*); +is_pod_array_helper is_POD_array(T*); template <> -struct is_POD_helper +struct is_pod_helper { template struct result_ { @@ -100,11 +100,11 @@ struct is_POD_helper }; -template struct is_POD_impl +template struct is_pod_impl { BOOST_STATIC_CONSTANT( bool, value = ( - ::boost::detail::is_POD_helper< + ::boost::detail::is_pod_helper< ::boost::is_array::value >::template result_::value ) @@ -113,20 +113,20 @@ template struct is_POD_impl #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_POD,T,::boost::detail::is_POD_impl::value) -BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pod,T,::boost::is_POD::value) - // the following help compilers without partial specialization support: -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_POD,void,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void,true) #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_POD,void const,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_POD,void volatile,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_POD,void const volatile,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void const,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void volatile,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void const volatile,true) #endif +} // namespace detail + +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_POD,T,::boost::detail::is_pod_impl::value) +BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pod,T,::boost::is_POD::value) + } // namespace boost #include "boost/type_traits/detail/bool_trait_undef.hpp" diff --git a/include/boost/type_traits/is_pointer.hpp b/include/boost/type_traits/is_pointer.hpp index ce5c302..95f3236 100644 --- a/include/boost/type_traits/is_pointer.hpp +++ b/include/boost/type_traits/is_pointer.hpp @@ -70,14 +70,10 @@ struct is_pointer_impl BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pointer,T,::boost::detail::is_pointer_impl::value) #if defined(__BORLANDC__) && !defined(__COMO__) -template struct is_pointer -{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template struct is_pointer -{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template struct is_pointer -{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template struct is_pointer -{ BOOST_STATIC_CONSTANT(bool, value = false); }; +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T&,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T& const,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T& volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_pointer,T& const volatile,false) #endif #else // no partial template specialization @@ -123,17 +119,17 @@ struct is_pointer_impl { }; +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pointer,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pointer,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pointer,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pointer,void const volatile,false) +#endif + } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pointer,T,::boost::detail::is_pointer_impl::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pointer,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pointer,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pointer,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pointer,void const volatile,false) -#endif - #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost diff --git a/include/boost/type_traits/is_reference.hpp b/include/boost/type_traits/is_reference.hpp index b92de3d..325d430 100644 --- a/include/boost/type_traits/is_reference.hpp +++ b/include/boost/type_traits/is_reference.hpp @@ -86,15 +86,16 @@ struct is_reference_impl ); }; +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_reference,void const volatile,false) +#endif + } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,::boost::detail::is_reference_impl::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void volatile,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_reference,void const volatile,false) -#endif #ifdef BOOST_MSVC # pragma warning(pop) diff --git a/include/boost/type_traits/is_volatile.hpp b/include/boost/type_traits/is_volatile.hpp index dd3395a..b907a50 100644 --- a/include/boost/type_traits/is_volatile.hpp +++ b/include/boost/type_traits/is_volatile.hpp @@ -92,16 +92,17 @@ struct is_volatile_impl { }; +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_volatile,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_volatile,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_volatile,void volatile,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_volatile,void const volatile,true) +#endif + } // namespace detail //* is a type T declared volatile - is_volatile BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_volatile,T,::boost::detail::is_volatile_impl::value) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_volatile,void,false) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_volatile,void const,false) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_volatile,void volatile,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_volatile,void const volatile,true) -#endif #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/include/boost/type_traits/remove_const.hpp b/include/boost/type_traits/remove_const.hpp index 5edeffe..999220e 100644 --- a/include/boost/type_traits/remove_const.hpp +++ b/include/boost/type_traits/remove_const.hpp @@ -60,7 +60,7 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T #else -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,T) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename detail::remove_const_impl::type) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/include/boost/type_traits/remove_cv.hpp b/include/boost/type_traits/remove_cv.hpp index 1b1f60a..dcb828b 100644 --- a/include/boost/type_traits/remove_cv.hpp +++ b/include/boost/type_traits/remove_cv.hpp @@ -33,8 +33,17 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T con #else -// doesn't work -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,T) +namespace detail { +template +struct remove_cv_impl +{ + typedef typename remove_volatile_impl< + typename remove_const_impl::type + >::type type; +}; +} + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename detail::remove_cv_impl::type) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/include/boost/type_traits/remove_pointer.hpp b/include/boost/type_traits/remove_pointer.hpp index fc51c4a..37dc820 100644 --- a/include/boost/type_traits/remove_pointer.hpp +++ b/include/boost/type_traits/remove_pointer.hpp @@ -18,13 +18,18 @@ namespace boost { -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,T) - #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T*,T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const,T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* volatile,T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const volatile,T) + +#else + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename detail::remove_pointer_impl::type) + #endif } // namespace boost diff --git a/include/boost/type_traits/remove_reference.hpp b/include/boost/type_traits/remove_reference.hpp index 45bd305..78ef6cb 100644 --- a/include/boost/type_traits/remove_reference.hpp +++ b/include/boost/type_traits/remove_reference.hpp @@ -18,9 +18,9 @@ namespace boost { -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,T) - #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T&,T) #if defined(__BORLANDC__) @@ -33,6 +33,10 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T& volatile, BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T& const volatile,T) #endif +#else + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,typename detail::remove_reference_impl::type) + #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost diff --git a/include/boost/type_traits/remove_volatile.hpp b/include/boost/type_traits/remove_volatile.hpp index 83c9f62..ef88773 100644 --- a/include/boost/type_traits/remove_volatile.hpp +++ b/include/boost/type_traits/remove_volatile.hpp @@ -59,8 +59,7 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile #else -// doesn't work -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,T) +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename detail::remove_volatile_impl::type) #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/include/boost/type_traits/type_with_alignment.hpp b/include/boost/type_traits/type_with_alignment.hpp index 9eb43e2..91d3aca 100644 --- a/include/boost/type_traits/type_with_alignment.hpp +++ b/include/boost/type_traits/type_with_alignment.hpp @@ -80,18 +80,17 @@ struct is_aligned ); }; +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::max_align,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<1> ,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<2> ,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<4> ,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<8> ,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<10> ,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<16> ,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::detail::lower_alignment<32> ,true) + } // namespace detail -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,::boost::detail::max_align,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,detail::lower_alignment<1> ,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,::boost::detail::lower_alignment<2> ,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,::boost::detail::lower_alignment<4> ,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,::boost::detail::lower_alignment<8> ,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,::boost::detail::lower_alignment<10> ,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,::boost::detail::lower_alignment<16> ,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,::boost::detail::lower_alignment<32> ,true) - - // This alignment method originally due to Brian Parker, implemented by David // Abrahams, and then ported here by Doug Gregor. template @@ -134,10 +133,13 @@ struct a8{ double s; }; struct a16{ long double s; }; #pragma option pop } -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,::boost::align::a2,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,::boost::align::a4,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,::boost::align::a8,true) -BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_pod,::boost::align::a16,true) + +namespace detail { +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a2,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a4,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a8,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a16,true) +} template struct type_with_alignment {