diff --git a/include/boost/type_traits/composite_traits.hpp b/include/boost/type_traits/composite_traits.hpp index 4786863..6baf895 100644 --- a/include/boost/type_traits/composite_traits.hpp +++ b/include/boost/type_traits/composite_traits.hpp @@ -66,9 +66,6 @@ template struct is_array #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace detail{ - template - struct is_reference_or_const_volatile; - struct pointer_helper { pointer_helper(const volatile void*); @@ -139,29 +136,31 @@ template ::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29)); - - - template - yes_type is_array_helper(const volatile void*, const volatile void*, void (*)(T x[])); - template - no_type is_array_helper(T*const volatile*, const volatile void*, void (*)(T x[])); - no_type BOOST_TT_DECL is_array_helper(...); } // namespace detail + +namespace detail +{ + template struct wrap {}; + + template T(* is_array_helper1(wrap) )(wrap); + char is_array_helper1(...); + + template no_type is_array_helper2(T(*)(wrap)); + yes_type is_array_helper2(...); +} + template struct is_array { -private: - static T t; public: - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - (1 == sizeof(detail::is_array_helper(&t, t, (void(*)(T))0))), - ::boost::type_traits::ice_not< - ::boost::detail::is_reference_or_const_volatile::value>::value, - ::boost::type_traits::ice_not< - (1 == sizeof(detail::is_function_tester(t)))>::value - >::value)); + BOOST_STATIC_CONSTANT( + bool, value = sizeof( + ::boost::detail::is_array_helper2( + ::boost::detail::is_array_helper1( + ::boost::detail::wrap()))) == 1 + ); }; + template <> struct is_array { @@ -281,23 +280,7 @@ template struct is_reference #endif // BOOST_MSVC namespace detail -{ - template struct is_reference_or_const_volatile - { - private: - typedef T const volatile cv_t; - public: - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - ::boost::type_traits::ice_not< - ::boost::is_const::value - >::value, - ::boost::type_traits::ice_not< - ::boost::is_volatile::value>::value - >::value)); - }; - - template struct wrap {}; +{ template T&(* is_reference_helper1(wrap) )(wrap); char is_reference_helper1(...); diff --git a/tests/composite_traits_test.cpp b/tests/composite_traits_test.cpp index 01dc843..393b312 100644 --- a/tests/composite_traits_test.cpp +++ b/tests/composite_traits_test.cpp @@ -50,9 +50,7 @@ int cpp_main(int argc, char* argv[]) value_test(false, boost::is_array::value) value_test(false, boost::is_array::value) value_test(false, boost::is_array::value) -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION value_test(false, boost::is_array::value) -#endif value_test(false, boost::is_array::value) value_test(false, boost::is_pointer::value)