sl@0: // Copyright David Abrahams 2002. sl@0: // Distributed under the Boost Software License, Version 1.0. (See sl@0: // accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: #ifndef INDIRECT_TRAITS_DWA2002131_HPP sl@0: # define INDIRECT_TRAITS_DWA2002131_HPP sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: sl@0: # include sl@0: # include sl@0: sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: # include sl@0: sl@0: # ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION sl@0: # include sl@0: # endif sl@0: sl@0: namespace boost { namespace detail { sl@0: sl@0: namespace indirect_traits { sl@0: sl@0: # ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION sl@0: template sl@0: struct is_reference_to_const : mpl::false_ sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_const : mpl::true_ sl@0: { sl@0: }; sl@0: sl@0: # if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround sl@0: template sl@0: struct is_reference_to_const : mpl::true_ sl@0: { sl@0: }; sl@0: # endif sl@0: sl@0: template sl@0: struct is_reference_to_function : mpl::false_ sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_function : is_function sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_pointer_to_function : mpl::false_ sl@0: { sl@0: }; sl@0: sl@0: // There's no such thing as a pointer-to-cv-function, so we don't need sl@0: // specializations for those sl@0: template sl@0: struct is_pointer_to_function : is_function sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_member_function_pointer_impl : mpl::false_ sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_member_function_pointer_impl sl@0: : is_member_function_pointer::type> sl@0: { sl@0: }; sl@0: sl@0: sl@0: template sl@0: struct is_reference_to_member_function_pointer sl@0: : is_reference_to_member_function_pointer_impl sl@0: { sl@0: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T)) sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_function_pointer_aux sl@0: : mpl::and_< sl@0: is_reference sl@0: , is_pointer_to_function< sl@0: typename remove_cv< sl@0: typename remove_reference::type sl@0: >::type sl@0: > sl@0: > sl@0: { sl@0: // There's no such thing as a pointer-to-cv-function, so we don't need specializations for those sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_function_pointer sl@0: : mpl::if_< sl@0: is_reference_to_function sl@0: , mpl::false_ sl@0: , is_reference_to_function_pointer_aux sl@0: >::type sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_non_const sl@0: : mpl::and_< sl@0: is_reference sl@0: , mpl::not_< sl@0: is_reference_to_const sl@0: > sl@0: > sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_volatile : mpl::false_ sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_volatile : mpl::true_ sl@0: { sl@0: }; sl@0: sl@0: # if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround sl@0: template sl@0: struct is_reference_to_volatile : mpl::true_ sl@0: { sl@0: }; sl@0: # endif sl@0: sl@0: sl@0: template sl@0: struct is_reference_to_pointer : mpl::false_ sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_pointer : mpl::true_ sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_pointer : mpl::true_ sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_pointer : mpl::true_ sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_pointer : mpl::true_ sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_class sl@0: : mpl::and_< sl@0: is_reference sl@0: , is_class< sl@0: typename remove_cv< sl@0: typename remove_reference::type sl@0: >::type sl@0: > sl@0: > sl@0: { sl@0: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T)) sl@0: }; sl@0: sl@0: template sl@0: struct is_pointer_to_class sl@0: : mpl::and_< sl@0: is_pointer sl@0: , is_class< sl@0: typename remove_cv< sl@0: typename remove_pointer::type sl@0: >::type sl@0: > sl@0: > sl@0: { sl@0: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T)) sl@0: }; sl@0: sl@0: # else sl@0: sl@0: using namespace boost::detail::is_function_ref_tester_; sl@0: sl@0: typedef char (&inner_yes_type)[3]; sl@0: typedef char (&inner_no_type)[2]; sl@0: typedef char (&outer_no_type)[1]; sl@0: sl@0: template sl@0: struct is_const_help sl@0: { sl@0: typedef typename mpl::if_< sl@0: is_const sl@0: , inner_yes_type sl@0: , inner_no_type sl@0: >::type type; sl@0: }; sl@0: sl@0: template sl@0: struct is_volatile_help sl@0: { sl@0: typedef typename mpl::if_< sl@0: is_volatile sl@0: , inner_yes_type sl@0: , inner_no_type sl@0: >::type type; sl@0: }; sl@0: sl@0: template sl@0: struct is_pointer_help sl@0: { sl@0: typedef typename mpl::if_< sl@0: is_pointer sl@0: , inner_yes_type sl@0: , inner_no_type sl@0: >::type type; sl@0: }; sl@0: sl@0: template sl@0: struct is_class_help sl@0: { sl@0: typedef typename mpl::if_< sl@0: is_class sl@0: , inner_yes_type sl@0: , inner_no_type sl@0: >::type type; sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_function_aux sl@0: { sl@0: static T t; sl@0: BOOST_STATIC_CONSTANT( sl@0: bool, value = sizeof(detail::is_function_ref_tester(t,0)) == sizeof(::boost::type_traits::yes_type)); sl@0: typedef mpl::bool_ type; sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_function sl@0: : mpl::if_, is_reference_to_function_aux, mpl::bool_ >::type sl@0: { sl@0: }; sl@0: sl@0: template sl@0: struct is_pointer_to_function_aux sl@0: { sl@0: static T t; sl@0: BOOST_STATIC_CONSTANT( sl@0: bool, value sl@0: = sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type)); sl@0: typedef mpl::bool_ type; sl@0: }; sl@0: sl@0: template sl@0: struct is_pointer_to_function sl@0: : mpl::if_, is_pointer_to_function_aux, mpl::bool_ >::type sl@0: { sl@0: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_function,(T)) sl@0: }; sl@0: sl@0: struct false_helper1 sl@0: { sl@0: template sl@0: struct apply : mpl::false_ sl@0: { sl@0: }; sl@0: }; sl@0: sl@0: template sl@0: typename is_const_help::type reference_to_const_helper(V&); sl@0: outer_no_type sl@0: reference_to_const_helper(...); sl@0: sl@0: struct true_helper1 sl@0: { sl@0: template sl@0: struct apply sl@0: { sl@0: static T t; sl@0: BOOST_STATIC_CONSTANT( sl@0: bool, value sl@0: = sizeof(reference_to_const_helper(t)) == sizeof(inner_yes_type)); sl@0: typedef mpl::bool_ type; sl@0: }; sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_const_helper1 : true_helper1 sl@0: { sl@0: }; sl@0: sl@0: template <> sl@0: struct is_reference_to_const_helper1 : false_helper1 sl@0: { sl@0: }; sl@0: sl@0: sl@0: template sl@0: struct is_reference_to_const sl@0: : is_reference_to_const_helper1::value>::template apply sl@0: { sl@0: }; sl@0: sl@0: sl@0: template sl@0: struct is_reference_to_non_const_helper1 sl@0: { sl@0: template sl@0: struct apply sl@0: { sl@0: static T t; sl@0: BOOST_STATIC_CONSTANT( sl@0: bool, value sl@0: = sizeof(reference_to_const_helper(t)) == sizeof(inner_no_type)); sl@0: sl@0: typedef mpl::bool_ type; sl@0: }; sl@0: }; sl@0: sl@0: template <> sl@0: struct is_reference_to_non_const_helper1 : false_helper1 sl@0: { sl@0: }; sl@0: sl@0: sl@0: template sl@0: struct is_reference_to_non_const sl@0: : is_reference_to_non_const_helper1::value>::template apply sl@0: { sl@0: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_non_const,(T)) sl@0: }; sl@0: sl@0: sl@0: template sl@0: typename is_volatile_help::type reference_to_volatile_helper(V&); sl@0: outer_no_type sl@0: reference_to_volatile_helper(...); sl@0: sl@0: template sl@0: struct is_reference_to_volatile_helper1 sl@0: { sl@0: template sl@0: struct apply sl@0: { sl@0: static T t; sl@0: BOOST_STATIC_CONSTANT( sl@0: bool, value sl@0: = sizeof(reference_to_volatile_helper(t)) == sizeof(inner_yes_type)); sl@0: typedef mpl::bool_ type; sl@0: }; sl@0: }; sl@0: sl@0: template <> sl@0: struct is_reference_to_volatile_helper1 : false_helper1 sl@0: { sl@0: }; sl@0: sl@0: sl@0: template sl@0: struct is_reference_to_volatile sl@0: : is_reference_to_volatile_helper1::value>::template apply sl@0: { sl@0: }; sl@0: sl@0: template sl@0: typename is_pointer_help::type reference_to_pointer_helper(V&); sl@0: outer_no_type reference_to_pointer_helper(...); sl@0: sl@0: template sl@0: struct reference_to_pointer_impl sl@0: { sl@0: static T t; sl@0: BOOST_STATIC_CONSTANT( sl@0: bool, value sl@0: = (sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type)) sl@0: ); sl@0: sl@0: typedef mpl::bool_ type; sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_pointer sl@0: : mpl::eval_if, reference_to_pointer_impl, mpl::false_>::type sl@0: { sl@0: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T)) sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_function_pointer sl@0: : mpl::eval_if, is_pointer_to_function_aux, mpl::false_>::type sl@0: { sl@0: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T)) sl@0: }; sl@0: sl@0: sl@0: template sl@0: struct is_member_function_pointer_help sl@0: : mpl::if_, inner_yes_type, inner_no_type> sl@0: {}; sl@0: sl@0: template sl@0: typename is_member_function_pointer_help::type member_function_pointer_helper(V&); sl@0: outer_no_type member_function_pointer_helper(...); sl@0: sl@0: template sl@0: struct is_pointer_to_member_function_aux sl@0: { sl@0: static T t; sl@0: BOOST_STATIC_CONSTANT( sl@0: bool, value sl@0: = sizeof((member_function_pointer_helper)(t)) == sizeof(inner_yes_type)); sl@0: typedef mpl::bool_ type; sl@0: }; sl@0: sl@0: template sl@0: struct is_reference_to_member_function_pointer sl@0: : mpl::if_< sl@0: is_reference sl@0: , is_pointer_to_member_function_aux sl@0: , mpl::bool_ sl@0: >::type sl@0: { sl@0: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T)) sl@0: }; sl@0: sl@0: template sl@0: typename is_class_help::type reference_to_class_helper(V const volatile&); sl@0: outer_no_type reference_to_class_helper(...); sl@0: sl@0: template sl@0: struct is_reference_to_class sl@0: { sl@0: static T t; sl@0: BOOST_STATIC_CONSTANT( sl@0: bool, value sl@0: = (is_reference::value sl@0: & (sizeof(reference_to_class_helper(t)) == sizeof(inner_yes_type))) sl@0: ); sl@0: typedef mpl::bool_ type; sl@0: BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T)) sl@0: }; sl@0: sl@0: template sl@0: typename is_class_help::type pointer_to_class_helper(V const volatile*); sl@0: outer_no_type pointer_to_class_helper(...); sl@0: sl@0: template sl@0: struct is_pointer_to_class sl@0: { sl@0: static T t; sl@0: BOOST_STATIC_CONSTANT( sl@0: bool, value sl@0: = (is_pointer::value sl@0: && sizeof(pointer_to_class_helper(t)) == sizeof(inner_yes_type)) sl@0: ); sl@0: typedef mpl::bool_ type; sl@0: }; sl@0: # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION sl@0: sl@0: } sl@0: sl@0: using namespace indirect_traits; sl@0: sl@0: }} // namespace boost::python::detail sl@0: sl@0: #endif // INDIRECT_TRAITS_DWA2002131_HPP