// (C) Copyright Edward Diener 2011,2012,2013 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). #if !defined(BOOST_TTI_DETAIL_MEM_DATA_HPP) #define BOOST_TTI_DETAIL_MEM_DATA_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined(BOOST_MSVC) || (BOOST_WORKAROUND(BOOST_GCC, >= 40400) && BOOST_WORKAROUND(BOOST_GCC, < 40600)) #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_OP(trait,name) \ template \ struct BOOST_PP_CAT(trait,_detail_hmd_op) \ { \ template \ struct return_of; \ \ template \ struct return_of \ { \ typedef BOOST_TTI_DETAIL_TP_R type; \ }; \ \ template \ struct menable_if; \ \ template \ struct menable_if \ { \ typedef BOOST_TTI_DETAIL_TP_U type; \ }; \ \ template \ static ::boost::type_traits::yes_type check2(BOOST_TTI_DETAIL_TP_V BOOST_TTI_DETAIL_TP_U::*); \ \ template \ static ::boost::type_traits::no_type check2(BOOST_TTI_DETAIL_TP_U); \ \ template \ static typename \ menable_if \ < \ sizeof(check2(&BOOST_TTI_DETAIL_TP_U::name))==sizeof(::boost::type_traits::yes_type), \ ::boost::type_traits::yes_type \ > \ ::type \ has_matching_member(int); \ \ template \ static ::boost::type_traits::no_type has_matching_member(...); \ \ template \ struct ttc_md \ { \ typedef boost::mpl::bool_::type>(0))==sizeof(::boost::type_traits::yes_type)> type; \ }; \ \ typedef typename ttc_md::type type; \ \ }; \ /**/ #else // !defined(BOOST_MSVC) #include #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_OP(trait,name) \ BOOST_TTI_DETAIL_TRAIT_HAS_TYPES_MEMBER_FUNCTION(trait,name) \ template \ struct BOOST_PP_CAT(trait,_detail_hmd_op) : \ BOOST_PP_CAT(trait,_detail_hmf_types) \ { \ }; \ /**/ #endif // defined(BOOST_MSVC) #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_INVOKE_ENCLOSING_CLASS(trait) \ template \ struct BOOST_PP_CAT(trait,_detail_hmd_invoke_enclosing_class) : \ BOOST_PP_CAT(trait,_detail_hmd_op) \ < \ typename BOOST_TTI_NAMESPACE::detail::ptmd::type, \ typename boost::remove_const::type \ > \ { \ }; \ /**/ #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_INVOKE_PT_MEMBER(trait) \ template \ struct BOOST_PP_CAT(trait,_detail_hmd_invoke_pt_member) : \ BOOST_PP_CAT(trait,_detail_hmd_op) \ < \ typename BOOST_TTI_NAMESPACE::detail::dmem_get_type::type, \ typename boost::remove_const \ < \ typename BOOST_TTI_NAMESPACE::detail::dmem_get_enclosing::type \ >::type \ > \ { \ }; \ /**/ #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_WITH_ENCLOSING_CLASS(trait) \ BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_INVOKE_ENCLOSING_CLASS(trait) \ template \ struct BOOST_PP_CAT(trait,_detail_hmd_with_enclosing_class) : \ boost::mpl::eval_if \ < \ BOOST_TTI_NAMESPACE::detail::enclosing_type, \ BOOST_PP_CAT(trait,_detail_hmd_invoke_enclosing_class) \ < \ BOOST_TTI_DETAIL_TP_ET, \ BOOST_TTI_DETAIL_TP_TYPE \ >, \ boost::mpl::false_ \ > \ { \ }; \ /**/ #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA(trait,name) \ BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_OP(trait,name) \ BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_WITH_ENCLOSING_CLASS(trait) \ BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_INVOKE_PT_MEMBER(trait) \ template \ struct BOOST_PP_CAT(trait,_detail_hmd) : \ boost::mpl::eval_if \ < \ boost::is_same, \ BOOST_PP_CAT(trait,_detail_hmd_invoke_pt_member) \ < \ BOOST_TTI_DETAIL_TP_ET, \ BOOST_TTI_DETAIL_TP_TYPE \ >, \ BOOST_PP_CAT(trait,_detail_hmd_with_enclosing_class) \ < \ BOOST_TTI_DETAIL_TP_ET, \ BOOST_TTI_DETAIL_TP_TYPE \ > \ > \ { \ }; \ /**/ namespace boost { namespace tti { namespace detail { template struct ptmd { typedef BOOST_TTI_DETAIL_TP_R BOOST_TTI_DETAIL_TP_T::* type; }; template struct dmem_check_ptmd : boost::mpl::identity { BOOST_MPL_ASSERT((boost::function_types::is_member_object_pointer)); }; template struct dmem_check_ptec : BOOST_TTI_NAMESPACE::detail::class_type { BOOST_MPL_ASSERT((boost::function_types::is_member_object_pointer)); }; template struct dmem_get_type : boost::mpl::eval_if < boost::is_same, BOOST_TTI_NAMESPACE::detail::dmem_check_ptmd, BOOST_TTI_NAMESPACE::detail::ptmd > { }; template struct dmem_get_enclosing : boost::mpl::eval_if < boost::is_same, BOOST_TTI_NAMESPACE::detail::dmem_check_ptec, boost::mpl::identity > { }; } } } #endif // BOOST_TTI_DETAIL_MEM_DATA_HPP