From f0b1834a4d105edaaea79f9c2bfa9d59eb5057f7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 11 Oct 2013 23:17:48 +0000 Subject: [PATCH] Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION Process #ifndef...#else...#endif blocks. [SVN r86245] --- include/boost/type_traits/function_traits.hpp | 62 ------------- include/boost/type_traits/is_class.hpp | 11 --- include/boost/type_traits/is_const.hpp | 7 -- include/boost/type_traits/is_empty.hpp | 87 ------------------- include/boost/type_traits/is_object.hpp | 8 -- include/boost/type_traits/is_pod.hpp | 66 -------------- include/boost/type_traits/is_same.hpp | 53 ----------- include/boost/type_traits/is_volatile.hpp | 7 -- include/boost/type_traits/remove_const.hpp | 6 -- include/boost/type_traits/remove_cv.hpp | 16 ---- .../boost/type_traits/remove_reference.hpp | 6 -- include/boost/type_traits/remove_volatile.hpp | 6 -- 12 files changed, 335 deletions(-) diff --git a/include/boost/type_traits/function_traits.hpp b/include/boost/type_traits/function_traits.hpp index d715345..26d7e05 100644 --- a/include/boost/type_traits/function_traits.hpp +++ b/include/boost/type_traits/function_traits.hpp @@ -15,7 +15,6 @@ namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace detail { template struct function_traits_helper; @@ -170,67 +169,6 @@ struct function_traits : { }; -#else - -namespace detail { - -template -struct type_of_size -{ - char elements[N]; -}; - -template -type_of_size<1> function_arity_helper(R (*f)()); - -template -type_of_size<2> function_arity_helper(R (*f)(T1)); - -template -type_of_size<3> function_arity_helper(R (*f)(T1, T2)); - -template -type_of_size<4> function_arity_helper(R (*f)(T1, T2, T3)); - -template -type_of_size<5> function_arity_helper(R (*f)(T1, T2, T3, T4)); - -template -type_of_size<6> function_arity_helper(R (*f)(T1, T2, T3, T4, T5)); - -template -type_of_size<7> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6)); - -template -type_of_size<8> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7)); - -template -type_of_size<9> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8)); - -template -type_of_size<10> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8, - T9)); - -template -type_of_size<11> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8, - T9, T10)); -} // end namespace detail - -// Won't work with references -template -struct function_traits -{ - BOOST_STATIC_CONSTANT(unsigned, arity = (sizeof(boost::detail::function_arity_helper((Function*)0))-1)); -}; - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } #endif // BOOST_TT_FUNCTION_TRAITS_HPP_INCLUDED diff --git a/include/boost/type_traits/is_class.hpp b/include/boost/type_traits/is_class.hpp index 1a2cd20..0675b57 100644 --- a/include/boost/type_traits/is_class.hpp +++ b/include/boost/type_traits/is_class.hpp @@ -93,7 +93,6 @@ struct is_class_impl template struct is_class_impl { -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< ::boost::type_traits::ice_not< ::boost::is_union::value >::value, @@ -103,16 +102,6 @@ struct is_class_impl ::boost::type_traits::ice_not< ::boost::is_void::value >::value, ::boost::type_traits::ice_not< ::boost::is_function::value >::value >::value)); -# else - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::type_traits::ice_not< ::boost::is_union::value >::value, - ::boost::type_traits::ice_not< ::boost::is_scalar::value >::value, - ::boost::type_traits::ice_not< ::boost::is_array::value >::value, - ::boost::type_traits::ice_not< ::boost::is_reference::value>::value, - ::boost::type_traits::ice_not< ::boost::is_void::value >::value - >::value)); -# endif }; # endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION diff --git a/include/boost/type_traits/is_const.hpp b/include/boost/type_traits/is_const.hpp index e429cb4..ac7ad1c 100644 --- a/include/boost/type_traits/is_const.hpp +++ b/include/boost/type_traits/is_const.hpp @@ -24,7 +24,6 @@ #include #include -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # include # ifdef __GNUC__ # include @@ -32,12 +31,6 @@ # if BOOST_WORKAROUND(BOOST_MSVC, < 1400) # include # endif -#else -# include -# include -# include -# include -#endif // should be the last #include #include diff --git a/include/boost/type_traits/is_empty.hpp b/include/boost/type_traits/is_empty.hpp index 8a2c5b8..adb239e 100644 --- a/include/boost/type_traits/is_empty.hpp +++ b/include/boost/type_traits/is_empty.hpp @@ -14,19 +14,9 @@ #include #include -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # include # include # include -#else -# include -# include -# include -# include -# include -# include -# include -#endif // should be always the last #include directive #include @@ -41,7 +31,6 @@ namespace boost { namespace detail { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #ifdef BOOST_MSVC #pragma warning(push) @@ -130,82 +119,6 @@ struct is_empty_impl #endif // __BORLANDC__ -#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#ifdef BOOST_MSVC6_MEMBER_TEMPLATES - -template -struct empty_helper_t1 : public T -{ - empty_helper_t1(); - int i[256]; -}; - -struct empty_helper_t2 { int i[256]; }; - -template -struct empty_helper_base -{ - enum { value = (sizeof(empty_helper_t1) == sizeof(empty_helper_t2)) }; -}; - -template -struct empty_helper_nonbase -{ - enum { value = false }; -}; - -template -struct empty_helper_chooser -{ - template struct result_ - { - typedef empty_helper_nonbase type; - }; -}; - -template <> -struct empty_helper_chooser -{ - template struct result_ - { - typedef empty_helper_base type; - }; -}; - -template -struct is_empty_impl -{ - typedef ::boost::detail::empty_helper_chooser< - ::boost::type_traits::ice_and< - ::boost::type_traits::ice_not< ::boost::is_reference::value >::value, - ::boost::type_traits::ice_not< ::boost::is_convertible::value >::value, - ::boost::type_traits::ice_not< ::boost::is_pointer::value >::value, - ::boost::type_traits::ice_not< ::boost::is_member_pointer::value >::value, - ::boost::type_traits::ice_not< ::boost::is_array::value >::value, - ::boost::type_traits::ice_not< ::boost::is_void::value >::value, - ::boost::type_traits::ice_not< - ::boost::is_convertible::value - >::value - >::value > chooser; - - typedef typename chooser::template result_ result; - typedef typename result::type eh_type; - - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or::value)); -}; - -#else - -template struct is_empty_impl -{ - BOOST_STATIC_CONSTANT(bool, value = BOOST_INTERNAL_IS_EMPTY(T)); -}; - -#endif // BOOST_MSVC6_MEMBER_TEMPLATES - -#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) diff --git a/include/boost/type_traits/is_object.hpp b/include/boost/type_traits/is_object.hpp index 3decbf8..1d1ae4f 100644 --- a/include/boost/type_traits/is_object.hpp +++ b/include/boost/type_traits/is_object.hpp @@ -26,20 +26,12 @@ namespace detail { template struct is_object_impl { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< ::boost::type_traits::ice_not< ::boost::is_reference::value>::value, ::boost::type_traits::ice_not< ::boost::is_void::value>::value, ::boost::type_traits::ice_not< ::boost::is_function::value>::value >::value)); -#else - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::type_traits::ice_not< ::boost::is_reference::value>::value, - ::boost::type_traits::ice_not< ::boost::is_void::value>::value - >::value)); -#endif }; } // namespace detail diff --git a/include/boost/type_traits/is_pod.hpp b/include/boost/type_traits/is_pod.hpp index b4e1733..820a3ce 100644 --- a/include/boost/type_traits/is_pod.hpp +++ b/include/boost/type_traits/is_pod.hpp @@ -33,7 +33,6 @@ template< typename T > struct is_POD; namespace detail { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template struct is_pod_impl { @@ -54,71 +53,6 @@ struct is_pod_impl }; #endif -#else - -template -struct is_pod_helper -{ - template struct result_ - { - BOOST_STATIC_CONSTANT( - bool, value = - (::boost::type_traits::ice_or< - ::boost::is_scalar::value, - ::boost::is_void::value, - BOOST_INTERNAL_IS_POD(T) - >::value)); - }; -}; - -template -struct bool_to_yes_no_type -{ - typedef ::boost::type_traits::no_type type; -}; - -template <> -struct bool_to_yes_no_type -{ - typedef ::boost::type_traits::yes_type type; -}; - -template -struct is_pod_array_helper -{ - enum { is_pod = ::boost::is_POD::value }; // MSVC workaround - typedef typename bool_to_yes_no_type::type type; - type instance() const; -}; - -template -is_pod_array_helper is_POD_array(T*); - -template <> -struct is_pod_helper -{ - template struct result_ - { - static T& help(); - BOOST_STATIC_CONSTANT(bool, value = - sizeof(is_POD_array(help()).instance()) == sizeof(::boost::type_traits::yes_type) - ); - }; -}; - - -template struct is_pod_impl -{ - BOOST_STATIC_CONSTANT( - bool, value = ( - ::boost::detail::is_pod_helper< - ::boost::is_array::value - >::template result_::value - ) - ); -}; - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // the following help compilers without partial specialization support: BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void,true) diff --git a/include/boost/type_traits/is_same.hpp b/include/boost/type_traits/is_same.hpp index 75bbde9..c8987b0 100644 --- a/include/boost/type_traits/is_same.hpp +++ b/include/boost/type_traits/is_same.hpp @@ -27,7 +27,6 @@ namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_same,T,U,false) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename T,is_same,T,T,true) @@ -37,58 +36,6 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename T,is_same,T,T,true) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename T,is_same,T&,T&,true) #endif -#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -namespace detail { - -#ifdef BOOST_MSVC -// the following VC6 specific implementation is *NOT* legal -// C++, but has the advantage that it works for incomplete -// types. - -template< typename T1 > -struct is_same_part_1 -{ - template struct part_2 { enum { value = false }; }; - template<> struct part_2 { enum { value = true }; }; -}; - -template< typename T1, typename T2 > -struct is_same_impl -{ - enum { value = boost::detail::is_same_part_1::template part_2::value }; -}; - -#else // generic "no-partial-specialization" version - -template -::boost::type_traits::yes_type -BOOST_TT_DECL is_same_tester(T*, T*); - -::boost::type_traits::no_type -BOOST_TT_DECL is_same_tester(...); - -template -struct is_same_impl -{ - static T t; - static U u; - - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - (sizeof(type_traits::yes_type) == sizeof(boost::detail::is_same_tester(&t,&u))), - (::boost::is_reference::value == ::boost::is_reference::value), - (sizeof(T) == sizeof(U)) - >::value)); -}; - -#endif // BOOST_MSVC - -} // namespace detail - -BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_same,T,U,(::boost::detail::is_same_impl::value)) - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost diff --git a/include/boost/type_traits/is_volatile.hpp b/include/boost/type_traits/is_volatile.hpp index c921c9e..b0458f4 100644 --- a/include/boost/type_traits/is_volatile.hpp +++ b/include/boost/type_traits/is_volatile.hpp @@ -24,17 +24,10 @@ #include #include -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # include # if BOOST_WORKAROUND(BOOST_MSVC, < 1400) # include # endif -#else -# include -# include -# include -# include -#endif // should be the last #include #include diff --git a/include/boost/type_traits/remove_const.hpp b/include/boost/type_traits/remove_const.hpp index 7b7d9c5..7c67524 100644 --- a/include/boost/type_traits/remove_const.hpp +++ b/include/boost/type_traits/remove_const.hpp @@ -24,7 +24,6 @@ namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace detail { @@ -73,11 +72,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const volatile[N],T volatile type[N]) #endif -#else - -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename boost::detail::remove_const_impl::type) - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost diff --git a/include/boost/type_traits/remove_cv.hpp b/include/boost/type_traits/remove_cv.hpp index db64d21..4ae6ae4 100644 --- a/include/boost/type_traits/remove_cv.hpp +++ b/include/boost/type_traits/remove_cv.hpp @@ -23,7 +23,6 @@ namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace detail{ @@ -57,21 +56,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T vol BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T const volatile[N],T type[N]) #endif -#else - -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 boost::detail::remove_cv_impl::type) - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost diff --git a/include/boost/type_traits/remove_reference.hpp b/include/boost/type_traits/remove_reference.hpp index 5dbb909..5ed8208 100644 --- a/include/boost/type_traits/remove_reference.hpp +++ b/include/boost/type_traits/remove_reference.hpp @@ -18,7 +18,6 @@ namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace detail{ // @@ -53,11 +52,6 @@ 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 boost::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 033c546..d3d9134 100644 --- a/include/boost/type_traits/remove_volatile.hpp +++ b/include/boost/type_traits/remove_volatile.hpp @@ -24,7 +24,6 @@ namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace detail { @@ -71,11 +70,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T const volatile[N],T const type[N]) #endif -#else - -BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename boost::detail::remove_volatile_impl::type) - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // namespace boost