File indexing completed on 2025-01-18 09:52:54
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_TTI_DETAIL_MEM_DATA_HPP)
0008 #define BOOST_TTI_DETAIL_MEM_DATA_HPP
0009
0010 #include <boost/detail/workaround.hpp>
0011 #include <boost/function_types/components.hpp>
0012 #include <boost/function_types/is_member_object_pointer.hpp>
0013 #include <boost/mpl/assert.hpp>
0014 #include <boost/mpl/bool.hpp>
0015 #include <boost/mpl/eval_if.hpp>
0016 #include <boost/mpl/identity.hpp>
0017 #include <boost/preprocessor/cat.hpp>
0018 #include <boost/tti/detail/ddeftype.hpp>
0019 #include <boost/tti/detail/dftclass.hpp>
0020 #include <boost/tti/detail/denclosing_type.hpp>
0021 #include <boost/tti/gen/namespace_gen.hpp>
0022 #include <boost/type_traits/detail/yes_no_type.hpp>
0023 #include <boost/type_traits/is_same.hpp>
0024 #include <boost/type_traits/remove_const.hpp>
0025
0026 #if defined(BOOST_MSVC) || (BOOST_WORKAROUND(BOOST_GCC, >= 40400) && BOOST_WORKAROUND(BOOST_GCC, < 40600))
0027
0028 #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_OP(trait,name) \
0029 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_C> \
0030 struct BOOST_PP_CAT(trait,_detail_hmd_op) \
0031 { \
0032 template<class> \
0033 struct return_of; \
0034 \
0035 template<class BOOST_TTI_DETAIL_TP_R,class BOOST_TTI_DETAIL_TP_IC> \
0036 struct return_of<BOOST_TTI_DETAIL_TP_R BOOST_TTI_DETAIL_TP_IC::*> \
0037 { \
0038 typedef BOOST_TTI_DETAIL_TP_R type; \
0039 }; \
0040 \
0041 template<bool,typename BOOST_TTI_DETAIL_TP_U> \
0042 struct menable_if; \
0043 \
0044 template<typename BOOST_TTI_DETAIL_TP_U> \
0045 struct menable_if<true,BOOST_TTI_DETAIL_TP_U> \
0046 { \
0047 typedef BOOST_TTI_DETAIL_TP_U type; \
0048 }; \
0049 \
0050 template<typename BOOST_TTI_DETAIL_TP_U,typename BOOST_TTI_DETAIL_TP_V> \
0051 static ::boost::type_traits::yes_type check2(BOOST_TTI_DETAIL_TP_V BOOST_TTI_DETAIL_TP_U::*); \
0052 \
0053 template<typename BOOST_TTI_DETAIL_TP_U,typename BOOST_TTI_DETAIL_TP_V> \
0054 static ::boost::type_traits::no_type check2(BOOST_TTI_DETAIL_TP_U); \
0055 \
0056 template<typename BOOST_TTI_DETAIL_TP_U,typename BOOST_TTI_DETAIL_TP_V> \
0057 static typename \
0058 menable_if \
0059 < \
0060 sizeof(check2<BOOST_TTI_DETAIL_TP_U,BOOST_TTI_DETAIL_TP_V>(&BOOST_TTI_DETAIL_TP_U::name))==sizeof(::boost::type_traits::yes_type), \
0061 ::boost::type_traits::yes_type \
0062 > \
0063 ::type \
0064 has_matching_member(int); \
0065 \
0066 template<typename BOOST_TTI_DETAIL_TP_U,typename BOOST_TTI_DETAIL_TP_V> \
0067 static ::boost::type_traits::no_type has_matching_member(...); \
0068 \
0069 template<class BOOST_TTI_DETAIL_TP_U,class BOOST_TTI_DETAIL_TP_V> \
0070 struct ttc_md \
0071 { \
0072 typedef boost::mpl::bool_<sizeof(has_matching_member<BOOST_TTI_DETAIL_TP_V,typename return_of<BOOST_TTI_DETAIL_TP_U>::type>(0))==sizeof(::boost::type_traits::yes_type)> type; \
0073 }; \
0074 \
0075 typedef typename ttc_md<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_C>::type type; \
0076 \
0077 }; \
0078
0079
0080 #else
0081
0082 #include <boost/tti/detail/dmem_fun.hpp>
0083
0084 #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_OP(trait,name) \
0085 BOOST_TTI_DETAIL_TRAIT_HAS_TYPES_MEMBER_FUNCTION(trait,name) \
0086 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_C> \
0087 struct BOOST_PP_CAT(trait,_detail_hmd_op) : \
0088 BOOST_PP_CAT(trait,_detail_hmf_types)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_C> \
0089 { \
0090 }; \
0091
0092
0093 #endif
0094
0095 #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_INVOKE_ENCLOSING_CLASS(trait) \
0096 template<class BOOST_TTI_DETAIL_TP_ET,class BOOST_TTI_DETAIL_TP_TYPE> \
0097 struct BOOST_PP_CAT(trait,_detail_hmd_invoke_enclosing_class) : \
0098 BOOST_PP_CAT(trait,_detail_hmd_op) \
0099 < \
0100 typename BOOST_TTI_NAMESPACE::detail::ptmd<BOOST_TTI_DETAIL_TP_ET,BOOST_TTI_DETAIL_TP_TYPE>::type, \
0101 typename boost::remove_const<BOOST_TTI_DETAIL_TP_ET>::type \
0102 > \
0103 { \
0104 }; \
0105
0106
0107 #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_INVOKE_PT_MEMBER(trait) \
0108 template<class BOOST_TTI_DETAIL_TP_ET,class BOOST_TTI_DETAIL_TP_TYPE> \
0109 struct BOOST_PP_CAT(trait,_detail_hmd_invoke_pt_member) : \
0110 BOOST_PP_CAT(trait,_detail_hmd_op) \
0111 < \
0112 typename BOOST_TTI_NAMESPACE::detail::dmem_get_type<BOOST_TTI_DETAIL_TP_ET,BOOST_TTI_DETAIL_TP_TYPE>::type, \
0113 typename boost::remove_const \
0114 < \
0115 typename BOOST_TTI_NAMESPACE::detail::dmem_get_enclosing<BOOST_TTI_DETAIL_TP_ET,BOOST_TTI_DETAIL_TP_TYPE>::type \
0116 >::type \
0117 > \
0118 { \
0119 }; \
0120
0121
0122 #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_WITH_ENCLOSING_CLASS(trait) \
0123 BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_INVOKE_ENCLOSING_CLASS(trait) \
0124 template<class BOOST_TTI_DETAIL_TP_ET,class BOOST_TTI_DETAIL_TP_TYPE> \
0125 struct BOOST_PP_CAT(trait,_detail_hmd_with_enclosing_class) : \
0126 boost::mpl::eval_if \
0127 < \
0128 BOOST_TTI_NAMESPACE::detail::enclosing_type<BOOST_TTI_DETAIL_TP_ET>, \
0129 BOOST_PP_CAT(trait,_detail_hmd_invoke_enclosing_class) \
0130 < \
0131 BOOST_TTI_DETAIL_TP_ET, \
0132 BOOST_TTI_DETAIL_TP_TYPE \
0133 >, \
0134 boost::mpl::false_ \
0135 > \
0136 { \
0137 }; \
0138
0139
0140 #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA(trait,name) \
0141 BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_OP(trait,name) \
0142 BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_WITH_ENCLOSING_CLASS(trait) \
0143 BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA_INVOKE_PT_MEMBER(trait) \
0144 template<class BOOST_TTI_DETAIL_TP_ET,class BOOST_TTI_DETAIL_TP_TYPE> \
0145 struct BOOST_PP_CAT(trait,_detail_hmd) : \
0146 boost::mpl::eval_if \
0147 < \
0148 boost::is_same<BOOST_TTI_DETAIL_TP_TYPE,BOOST_TTI_NAMESPACE::detail::deftype>, \
0149 BOOST_PP_CAT(trait,_detail_hmd_invoke_pt_member) \
0150 < \
0151 BOOST_TTI_DETAIL_TP_ET, \
0152 BOOST_TTI_DETAIL_TP_TYPE \
0153 >, \
0154 BOOST_PP_CAT(trait,_detail_hmd_with_enclosing_class) \
0155 < \
0156 BOOST_TTI_DETAIL_TP_ET, \
0157 BOOST_TTI_DETAIL_TP_TYPE \
0158 > \
0159 > \
0160 { \
0161 }; \
0162
0163
0164 namespace boost
0165 {
0166 namespace tti
0167 {
0168 namespace detail
0169 {
0170
0171 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_R>
0172 struct ptmd
0173 {
0174 typedef BOOST_TTI_DETAIL_TP_R BOOST_TTI_DETAIL_TP_T::* type;
0175 };
0176
0177 template<class BOOST_TTI_DETAIL_TP_T>
0178 struct dmem_check_ptmd :
0179 boost::mpl::identity<BOOST_TTI_DETAIL_TP_T>
0180 {
0181 BOOST_MPL_ASSERT((boost::function_types::is_member_object_pointer<BOOST_TTI_DETAIL_TP_T>));
0182 };
0183
0184 template<class BOOST_TTI_DETAIL_TP_T>
0185 struct dmem_check_ptec :
0186 BOOST_TTI_NAMESPACE::detail::class_type<BOOST_TTI_DETAIL_TP_T>
0187 {
0188 BOOST_MPL_ASSERT((boost::function_types::is_member_object_pointer<BOOST_TTI_DETAIL_TP_T>));
0189 };
0190
0191 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_T2>
0192 struct dmem_get_type :
0193 boost::mpl::eval_if
0194 <
0195 boost::is_same<BOOST_TTI_DETAIL_TP_T2,BOOST_TTI_NAMESPACE::detail::deftype>,
0196 BOOST_TTI_NAMESPACE::detail::dmem_check_ptmd<BOOST_TTI_DETAIL_TP_T>,
0197 BOOST_TTI_NAMESPACE::detail::ptmd<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_T2>
0198 >
0199 {
0200 };
0201
0202 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_T2>
0203 struct dmem_get_enclosing :
0204 boost::mpl::eval_if
0205 <
0206 boost::is_same<BOOST_TTI_DETAIL_TP_T2,BOOST_TTI_NAMESPACE::detail::deftype>,
0207 BOOST_TTI_NAMESPACE::detail::dmem_check_ptec<BOOST_TTI_DETAIL_TP_T>,
0208 boost::mpl::identity<BOOST_TTI_DETAIL_TP_T>
0209 >
0210 {
0211 };
0212
0213 }
0214 }
0215 }
0216
0217 #endif