// (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 #if defined(BOOST_MSVC) || (BOOST_WORKAROUND(BOOST_GCC, >= 40400) && BOOST_WORKAROUND(BOOST_GCC, < 40600)) #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA(trait,name) \ template \ struct BOOST_PP_CAT(trait,_detail_hmd) \ { \ 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; \ \ BOOST_STATIC_CONSTANT(bool,value=type::value); \ \ }; \ /**/ #else // !defined(BOOST_MSVC) #include #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA(trait,name) \ BOOST_TTI_DETAIL_TRAIT_HAS_TYPES_MEMBER_FUNCTION(trait,name) \ template \ struct BOOST_PP_CAT(trait,_detail_hmd) : \ BOOST_PP_CAT(trait,_detail_types) \ { \ }; \ /**/ #endif // defined(BOOST_MSVC) 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